Skip to content
Eskais UI

Accounts

Device Approval

DeviceApproval: approve or deny a device that asked to pair. It shows the device's name, kind and detail, the pairing code through PairingCode with its comparison, a security warning, what the device gets and what it asked for but won't get (with why), items the person ticks to include (a marked one, like a replacement, needs its own confirmation), a countdown to the request's expiry, and Approve and Deny with pending and error states. Approve waits for a person when an agent presses it, stays off while the codes don't match, nothing is selected or a replacement isn't confirmed, and after expiry; agents never read or type the code.

Example

Approve a device
Check the code, then choose what happens.

Studio laptop

Desktop
Asked a moment ago from Lisbon

This device asked to connect to your workspace.

B C D F, G H J K

Type it to make sure you're approving the right device. Try BCDF-GHJK.

Only approve a device you're holding. Nobody from support will ask you for this code.

It will be able to

  • Read and edit projectsEvery project you can open today
  • Run jobs on your behalf

It asked for, but won't get

  • Manage membersYour role can't grant this.
  • See billingOnly owners can grant this.

This request expires in 5:00

Installation

npx shadcn@latest add @eskais/device-approval

Usage

Import
import { deviceApproval, deviceApprovalApprove } from "@/components/ui/device-approval-primitive"import { ApproveButton, PermissionSection } from "@/components/ui/device-approval-parts"import { confirmationKey, deviceApprovalItems, deviceApprovalMarkers } from "@/components/ui/device-approval-items-primitive"import { ConsentItems, consentBlocked, deviceConsentLabels, useConsentItems } from "@/components/ui/device-approval-items"import { DeviceApproval, deviceApprovalLabels } from "@/components/ui/device-approval"

The approval screen for a device that asked to pair: the device, the code and its comparison, what it gets and what it won't, a security warning and a countdown, with Approve and Deny (or your own actions). Put it in a Card; it fills the width on a phone.

API reference

PermissionSection

PropTypeDefault
kindrequired"granted" | "withheld"–
headingReactNode–
permissionsrequiredreadonly DevicePermission[]–

ApproveButton

PropTypeDefault
approverequired(event?: Event) => unknown–
blockedrequiredboolean–
pendingrequiredboolean–
describedBystring–
agentConfirmrequiredstring–
childrenrequiredReactNode–

ConsentItems

PropTypeDefault
itemsrequiredreadonly DeviceConsentItem[]–
selectedIdsrequiredreadonly string[]–
tickedrequiredreadonly string[]–
onSelectedIdsChangerequired(ids: string[], details: ChangeDetails<DeviceApprovalItemsChangeReason>) => void–
onTickedChangerequired(keys: string[]) => void–
lockedrequiredWhy nothing can change now, like a decision already sent.string | null–
headingReactNode–
labelsrequiredDeviceConsentLabels–

DeviceApproval

Takes DeviceApprovalBaseProps &.

Other exports

deviceApprovaldeviceApprovalApproveconfirmationKeydeviceApprovalItemsdeviceApprovalMarkersconsentBlockeddeviceConsentLabelsuseConsentItemsdeviceApprovalLabelstype DeviceApprovalApproveOptionstype DeviceApprovalApproveStatetype DeviceApprovalOptionstype DeviceApprovalStatetype DeviceDecisiontype DevicePermissiontype DeviceApprovalItemEntrytype DeviceApprovalItemsChangeReasontype DeviceApprovalItemsOptionstype DeviceApprovalItemsStatetype DeviceApprovalMarkedItemtype DeviceApprovalMarkersOptionstype DeviceApprovalMarkersStatetype DeviceApprovalUnselectabletype DeviceConsentItemtype DeviceConsentLabelstype DeviceConsentMarkertype DeviceConsentTexttype DeviceConsentUnconfirmedtype DeviceApprovalActionStatetype DeviceApprovalDecisiontype DeviceApprovalLabelstype DeviceApprovalPropstype DeviceApprovalTexttype DeviceInfo

Accessibility

  • The block is a group named by the device's name; each permission list is named by its heading, and ticks and ban signs tell them apart beside their colour.
  • The countdown is a timer that isn't live: the time left is announced once a minute and at 30, 20 and 10 seconds, and the expiry once.
  • Approve stays focusable with aria-disabled while the codes don't match, the app blocks it or the request has expired; a decision being sent marks the block busy.
  • approveBlockedReason shows beside the actions and describes Approve, so a screen reader hears why it's off.
  • A failed decision is a live alert with the app's own message when it rejects with a string or a node.
  • Items are checkboxes named by their labels; each confirmation of a marked item is its own checkbox described by the item, and why Approve waits shows beside the actions, naming what's missing.
  • A permission list shows its heading from text.granted or text.withheld, which TypeScript asks for only when the list is passed; a list without one renders no empty heading.

Agent actions

Approve carries data-agent-confirm, so an agent's approve waits for a person; deny is the block's own action. The code and its comparison are hidden from agents by default. Approving while the codes differ, while the app blocks it (with approveBlockedReason as the message), after expiry or twice fails the step with why. Items take select(idOrLabel, checked) with no person; confirmMarker(idOrLabel, checked, confirmation) sits in a group marked data-agent-confirm, so each tick waits for one; confirmation is the index in marker.confirm or its text, and can be left out when the item has one. The group's missing lists what's still unticked, and approve fails with why while nothing is selected or a confirmation is missing, naming it.

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.