Permission request
What an agent will touch before it first runs: each resource and action in plain verbs, once or always.
Recruiting agent wants to:
To screen the 14 new applicants for Product Designer and invite the strongest to a call.
Installation
npm i @uisatin/ui @uisatin/proimport '@uisatin/ui/styles.css'
import '@uisatin/pro/styles.css'
import { AgentPermissionRequest } from '@uisatin/pro/agent-permissions'Part of Satin Pro, the licensed edition: @uisatin/pro on top of @uisatin/ui at the same version, its stylesheet after Free's. Satin Pro isn't on npm yet.
About 3.6 kB of JavaScript, minified and gzipped, on top of the @uisatin/uicomponents it uses (React aside).
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The AgentPermissionRequest component (Satin Pro, @uisatin/pro/agent-permissions) is a div with role="group" that asks for the scopes an agent needs, one Checkbox row each, and answers with Don’t allow, Allow once or Always allow. The agent’s avatar sits centred in a tile of its tone, over a soft aura of the same tone. Each scope is { id, resource, actions, detail, label }; actions take "read", "write" and "send", and the title says them as verbs ("Read and write notes"). It is the question only: what follows an answer (closing the Dialog, granting the access) is the app’s part. value (the ticked ids) can be controlled; onAllow and onDeny may return a promise. Parts: AgentPermissionRoot, AgentPermissionHeader, AgentPermissionScopeList, AgentPermissionScope, AgentPermissionFooter.
| Prop | Type | Default |
|---|---|---|
agent | string{ name, initials?, tone?, avatar? } | — |
scopes | AgentPermissionScope[] | — |
description | ReactNode | — |
value | string[] | — |
defaultValue | string[] | every scope |
onValueChange | (value) => void | — |
onAllow | (mode, scopes) => void | Promise | — |
onDeny | () => void | Promise | — |
autoFocus | boolean | true in a Dialog |
className | string | — |
ref | Ref<HTMLDivElement> | — |
...props | ComponentProps<'div'>Other attributes go to <div> | — |
Accessibility
A role="group" named by its title ("Recruiting agent wants to:") and described by description. The agent’s tile and the aura behind it are hidden. The scopes are a list; each row is the label of its Checkbox, named by a plain verb and the resource ("Read candidates") and described by its detail, and a scope that sends adds ", Sends as you" to its name. Focus starts on Don’t allow, the safest answer, inside a Dialog (autoFocus elsewhere; it never takes focus from someone typing in a chat). While onAllow or onDeny runs, its button is aria-busy and the rest are disabled. The request doesn’t say what happened after an answer: close the Dialog and confirm it (a toast) in the app.
| Key | Action |
|---|---|
| Tab | Moves through the scopes’ checkboxes, then Don’t allow, Allow once and its arrow. |
| Space | On a scope: ticks or unticks it. |
| EnterorSpace | On Don’t allow or Allow once: answers. |
| EnterorSpaceor↓ | On the arrow: opens the menu with Always allow. |
| ↑or↓ | Moves in the menu; Enter picks, Esc closes it and returns to the arrow. |
Something wrong or missing on this page?
Report a problemSuggest an improvement