Picker trigger
The text trigger with a chevron that pickers use: repo, branch, model, environment.
import { PickerTrigger } from "@arcadia/ui"The text trigger every picker uses: workspace, branch, model, environment. No background, ever: the colour steps from text-2 to text-1 only after the pointer rests 80ms (hover intent) or while its popup is open, so sweeping across a toolbar doesn't flicker. The label ellipsises at the trigger's maximum width.
Examples
rootStyle takes where the trigger sits (margins, self-alignment, flex and grid placement, size bounds) and the knobs below, each a token of its kind. A colour, a raw length or any other property is a type error: a look that comes up twice becomes a variant.
| Knob | Takes | Default | Sets |
|---|---|---|---|
Ref<Control> | var(--control-sm) | Height. | |
Ref<Space> | var(--space-2) | The text side: padding before a label (8, 10 at md), and after it when there is no chevron. | |
Ref<Space> | Derived | var(--pt-px) | Padding before the icon or label: the text side, or (h − 14)/2 before an icon (R2). A glyph passed inside the label takes stylex.env.nest.iconInset("var(--pt-h)", <its box>). | |
Ref<Space> | var(--space-1-5) | Padding after the chevron: (h − 12)/2, the chevron's own side. | |
Ref<Radius> | var(--radius-md) | Corner radius (a pill is full). | |
Ref<Measure> | 240px | Width past which the label ellipsises. | |
Paint | var(--text-2) | Label colour at rest. | |
Paint | var(--text-1) | Label colour with hover intent or an open popup. | |
Paint | var(--icon-3) | Leading glyph colour at rest. | |
Paint | var(--icon-1) | Leading glyph colour with hover intent or an open popup. | |
Paint | var(--text-3) | Secondary value colour at rest. | |
Paint | var(--text-1) | Secondary value colour with hover intent or an open popup. | |
Paint | Ink | currentColor | Chevron colour (the label's by default). | |
number | 0.7 | Chevron opacity at rest (1: never dimmed). |
Each colour has a rest knob and a hover knob (--pt-fg, --pt-fg-hover), and disabled drops them to text-4 and icon-4. Content you put in the label that should take the glyph's live colour, such as a provider mark, reads var(--_pt-icon).
A <button>. As a MenuTrigger it gets aria-haspopup and aria-expanded, and focus moves into the menu and back. The icon and the chevron are decorative, so the accessible name is the visible value alone.
A value without its context reads poorly ("main, button"), so name what is being picked: aria-label="Branch: main", as in the example above. Keep the visible label in that name, so voice control can still find it by what it shows.
- EnterSpace
- Open the picker's menu
- Esc
- Close it and return focus
PickerTrigger
labelrequired- ReactNode
- The current value ("lumen", "spark-contributor"). Ellipsised at the trigger's max width.
sub- ReactNode
- Secondary value after the label at text-3, e.g. the effort level after a model name.
emphasis- boolean
- Rest at text-1 instead of text-2.
tone- "neutral" | "muted"
neutralrests at text-2 (workspace, model);mutedat text-3 (branch, environment).size- "sm" | "md"Default"sm"
- 24 (toolbars) or 28.
shape- "rounded" | "pill"Default"pill"
rootStyle- PickerTriggerStyle
- Typed StyleX override: where the trigger sits and its
--pt-*knobs. render- RenderProp<{ disabled: boolean }>
- Replace the rendered element, e.g.
render={<a href="/settings" />}, or a function of props and state. disabled- boolean
- Native disabled: no pointer events, no tooltip, skipped by Tab.
focusableWhenDisabled- boolean
- Keep a disabled control focusable and hoverable (
aria-disabled), so a tooltip can say why. nativeButton- boolean
- Button semantics, inferred from what renders: a
<button>is native, an<a>stays a link, anything else getsrole="button"and key handling.falseforces button semantics on whatever renders (a link acting as a button). className- string
- A product's hook class for its own layout rules. Being retired: new code places a trigger with
rootStyle; the call sites left are counted by ui.lint (kit-classname) and only go down.
Rest props go to <button> props.