Autonomy rule

Sets what an agent may do alone.

Control

  • Refunds under $50
    Do itAsk firstNever

    segmenteddefault

  • Refunds under $50

    select

States

  • Refunds under $50
    Do itAsk firstNever

    set

  • Refunds under $50
    Do itAsk firstNever

    unset

  • Email customers

    Replies on open tickets

    Do itAsk firstNever

    with description

  • Refunds over $500

    Set by your workspace admin

    Do itAsk firstNever

    disabled

Usage

When to use it
Use
A settings page of what an agent does without asking: refunds under a limit, emails to customers, deploys to staging.
Use
One action with a limit in its name, set to Do it, Ask first or Never.
Not for
A setting that is only on or off. Use Switch.
Not for
Asking once, for one call. Use Tool call.
Not for
Picking a number for the limit itself. Use Number input.

Rules

6 rules
Must
Write title as the action with its limit, such as "Refunds under $50". Because the title names the control, so a screen reader hears "Refunds under $50, Ask first", and "Refunds" alone hides the limit.
Must
Put rules in an ItemGroup named for the agent, one rule per row. Because the group draws the panel and the hairlines between rows, and its name says whose permissions these are.
Must
Save in onValueChange; never add a Save button per row. Because the control looks set the moment it is pressed, and a row that waits for Save leaves the agent on the old rule.
Should
Pass control="select" for more than three levels or a column under 24rem. Because a segmented control of four labels at 26px runs out of room and drops under the title on most phones.
Should
Pass disabled for a rule set elsewhere, and say who set it in description.
Never
Colour a level, such as coral for Never or green for Do it. Because colour in Glaze means a status, and a level is a setting; the chosen one is the glass thumb.

State order

3 states, highest first
1
disabled
2
set
3
unset

Accessibility

4 checks
The segmented control is a radio group named by the title; arrow keys move and choose.
The select's trigger is named by the title and reads its value.
The chosen level is the glass thumb and a checked radio, not colour.
Inside an ItemGroup each rule is a listitem.

Keyboard

3 keys
Tab
Moves to the rule's control.
Arrow keys
Choose the next or previous level (segmented).
Enter, Space
Opens the select.

Edge cases

5 edge cases
Narrow row
The control drops under the title, aligned to the end.
No value
No segment is chosen and the select is empty; pass the current level.
Long title
Truncates on one line; put the rest in description.
Right to left
The control sits at the start of the row's end, levels in reading order.
Dark theme
The thumb turns light glass with an ink label.

API

6 props
title
ReactNode
description
ReactNode
value, defaultValue, onValueChange
'auto' | 'ask' | 'never'
options
{value, label}[] default Do it, Ask first, Never
control
'segmented' | 'select' default 'segmented'
disabled
boolean default false

Tokens

11 tokens
--field
#efefef
--row
36px
--control-sm
26px
--line-faint
rgb(5 5 5 / 0.06)
--text-1
rgb(5 5 5 / 0.80)
--text-2
rgb(5 5 5 / 0.60)
--text-disabled
rgb(5 5 5 / 0.32)
--radius-pill
999px
--type-label
500 13px/1.35 var(--font-sans)
--type-label-sm
500 12px/1.35 var(--font-sans)
--type-body-sm
400 13px/1.5 var(--font-sans)

Install

For your coding agent

GitHub

Please star me pookie

141

A new design system every week

Leave your email before you copy the prompt.