HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • Artwork
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Brand SVG
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Meter
  • Multi Select
  • Native Select
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat
  • Stat Tabs
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Brand SVG
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Upload
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Phone Input
  • Popover
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sortable
  • Spinner
  • Stat
  • Stat Tabs
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Brand SVG
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Cart Button
  • Cart Line Item
  • Cart Summary
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • Fill Blank
  • File Icon
  • File Upload
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Person Avatar
  • Phone Input
  • Popover
  • Price
  • Product Card
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat
  • Stat Tabs
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
  • Accordion
  • Alert Dialog
  • Alert
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar Upload
  • Avatar
  • Badge
  • Banner
  • Bot Avatar
  • Brand SVG
  • Breadcrumb
  • Button Group
  • Button
  • Calendar
  • Card
  • Carousel
  • Cart Button
  • Cart Line Item
  • Cart Summary
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker Primitive
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • File Icon
  • File Upload
  • Fill Blank
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input Group
  • Input OTP
  • Input
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Person Avatar
  • Phone Input
  • Popover
  • Price
  • Product Card
  • Progress Circle
  • Progress
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat Tabs
  • Stat
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toggle Group
  • Toggle
  • Tooltip
  • Tree
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
  • Message Toolbar
Blocks
  • Airtable
  • Airtable Kanban
  • CRM
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • App Shell
  • Record Files
  • Settings Shell
  • Help Panel
  • Note Editor
  • Email Drafts
  • Task List
  • Notifications Panel
  • Dual Pane Sidebar
  • Team Members Panel
  • Mix Pack Builder
  • Record Picker and Date Quick-pick
  • Record List
  • Record Page
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • AI Assistant
  • Voice Message
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Standings
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Templates
  • Sign In Page
  • Upload Page
  • Showcase Onboarding
  • Agreement Sign
  • Email
  • Email Composer
  • Share Dialog
  • Integrations
  • Transactions
  • Analytics
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Agents

PreviousNext

Let an agent read and operate a UI built with Another UI's UI SDK components in two tool calls, with writes that wait for your say-so.

An agent that uses a web page the usual way reads the accessibility tree, then clicks and types, one tool call per step. The UI SDK components can be driven another way. They expose their state and actions to an agent bridge, so the agent asks the page what is on it (snapshot), then does a whole task in one call (act), going through the component's own API and your own change handlers.

UI SDK measured the difference on a project settings screen (rename the project, change its visibility, update two members and the notification settings, then save). With the agent bridge it took 2 tool calls, against 17 and 19 with browser tools on the same screen built with Base UI and Ark UI: 88% fewer calls, 92% fewer tokens, 77% faster and 85% cheaper, as medians of three runs. Those are UI SDK's numbers, run on their own screen with Claude Code; Another UI adds nothing to the benchmark and has not re-run it.

The bridge is part of UI SDK (@ui-sdk/react/agent, in beta). It works with the UI SDK base of Another UI, which is the default. Components from every other base (Radix, Base UI, React Aria) are plain elements to it.

Add it#

pnpm dlx shadcn@latest add https://anotherui.dev/r/agent-bridge.json

Then one line at the root of your app:

import { AgentBridge } from "@/lib/agent-bridge"
 
export function Providers({ children }: { children: React.ReactNode }) {
  return <AgentBridge>{children}</AgentBridge>
}

The bridge is created before its children render, so every component below it registers with it. Keep one <AgentBridge>, at the root. It keeps allow and confirm current as your app's state changes, and when it unmounts it takes them away, so a bridge you remove leaves nothing allowed. Outside React, call createAgentBridge() before the page renders.

What an agent can do#

With the bridge on, an agent (yours, or a browser's through WebMCP) can list the page and act on it:

agent.snapshot()
// [{ ref: "c1", component: "input", label: "Project name", value: "Apollo", actions: ["setValue", "clear"] }, ...]
 
await agent.act({
  steps: [
    { ref: "Project name", action: "setValue", args: ["Atlas"] },
    { ref: "Notifications", action: "setChecked", args: [true] },
    { ref: "Save", action: "press" },
  ],
})

A step names a component by its label, and the change goes through the component's own change callback, which receives source: "agent" and can cancel it. A four-step task (rename, switch a setting, choose a plan, save) counted both ways on the test form in tests/agent-bridge.test.tsx: 2 calls with the bridge (one snapshot, one act), and 5 with browser tools (one read of the page, then a fill, a switch click, a radio click and a click on Save). The browser-tool figure is counted from the steps, not measured with a model; UI SDK's benchmark above is the measured comparison.

Permissions: reads are free, writes ask#

The defaults are safe on purpose, so opting in cannot give an agent more than you meant to:

  • Reading is free. snapshot() and query() never ask, and an expect step (a check that changes nothing) needs no permission. The check itself can still fail on a wrong value.
  • Every other step is a write and goes to your allow. With no allow, writes are refused: the bridge is read-only.
  • A control marked data-agent-confirm always goes to confirm, never to allow. An allow: () => true cannot answer for the person. With no confirm, the step is refused.
<AgentBridge
  allow={(step) => window.confirm(`Let the agent ${step.action} "${step.label}"?`)}
  confirm={(message) => window.confirm(message)}
>
  {children}
</AgentBridge>
<Button data-agent-confirm="Charges $20 to your card" onClick={buyCredits}>
  Buy credits
</Button>

allow and confirm may return a promise, so you can show your own dialog. Keep a region out of the agent's view with data-agent-hidden, and show a filled field as [redacted] with data-agent-secret. To refuse a particular value, check details.source === "agent" in the component's change callback and call details.cancel(). UI SDK's permissions guide covers these in full.

Name what the agent should find#

A step finds a component by its label, so give every control a name a person would also hear:

  • A text field inside a Field takes its name from its FieldLabel (htmlFor matching the input's id).
  • A checkbox, switch, toggle, slider or radio group needs an aria-label when there is no visible label.
  • Tabs need an aria-label on TabsList; without one the snapshot lists them with no name.
  • Give a Select its options as items on the root. The agent can then choose an option by its label even while the list is closed: <Select items={[{ value: "public", label: "Public" }]}>.

WebMCP#

A browser that supports WebMCP can offer the page to its own agent. It is off by default:

<AgentBridge webmcp allow={...} confirm={...}>{children}</AgentBridge>

This registers snapshot, act and query with document.modelContext. Every step the browser's agent asks for still goes through the bridge's own allow and confirm first, so with no allow it can read and nothing else. WebMCP's own allow is a second gate after those, never a replacement: by default it lets through every step that is not marked for a person, and webmcp={{ allow }} narrows it. Do not turn on webmcp with allow: () => true expecting it to be the safety net. In a browser without WebMCP it does nothing. Add expose to also put the bridge on window.agent, to try agent.snapshot() in the console.

Which components are visible to it#

The bridge sees UI SDK components, with these actions:

ComponentActions
Input, TextareasetValue, clear
Checkbox, SwitchsetChecked
TogglesetPressed
Radio group, Tabs, SlidersetValue
Select, ComboboxsetOpen, setValue, clear, setQuery
AccordionsetValue, open, close, toggle, openAll, closeAll
DialogsetOpen, press
Buttonpress

What the test checked: every row above except Combobox has its name and actions confirmed in the snapshot. Steps were actually run on Input, Switch, Radio group and Button (and the permission rules); Select, Dialog, Tabs, Accordion, Slider, Toggle, Checkbox and Textarea are confirmed by their snapshot entry only, and no step was run on any popup. Combobox, Command, menus, Popover and the other popups come from the same SDK and should offer similar actions, but no test covers them yet.

Input and Textarea are built on the SDK's own Input and Textarea (the same native elements), which is what makes them visible. This makes both client components: a Server Component can still render them, but not with server-only props, and they now ship the SDK's input code on pages that never turn the bridge on. NativeSelect, Sidebar, Stepper, Table and the display components are plain elements and are not in the snapshot; an agent can still reach them with browser tools.

Test it#

The test in tests/agent-bridge.test.tsx mounts the Nova components, reads the snapshot and runs steps, including the permission rules. Running a step on a popup (Select, Dialog) needs a real browser: jsdom has no Popover API, so those are checked by their names and actions in the snapshot only. Try them in your own app with expose.

UI SDKMigrating from Radix

On This Page

Add itWhat an agent can doPermissions: reads are free, writes askName what the agent should findWebMCPWhich components are visible to itTest it