Combobox

Pick one option from a list you can filter by typing.

Status
Priority
Assignee

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/picker

Usage

import { Picker } from "./ui/uicontext/components/Picker.ts"
const Message = UiSchema.TaggedEnum({ PickedStatus: { value: Schema.String } })export const StatusPicker = (h: Html.H<typeof Message.Type>, status: string) =>	Picker(h, {		props: { name: "Status", options: statuses, selected: status, empty: statuses[0]! },		onEmit: { Picked: ({ value }) => Message.PickedStatus({ value }) },	})

Examples

Compact, in a list

With compact only the glyph shows, for a row's status or priority. Its accessible name still says the property and its value.

ENG-142
Sign-in link expires before the email arrives
ENG-139
Export to CSV drops the last row
ENG-131
Webhook retries ignore the backoff setting

Read-only and disabled

readOnly opens the list to show the choices without picking; disabled doesn't open at all.

Status
Assignee

API reference

Props

Picker props
NameTypeDescription
agentIdstringThis picker's id for agents, unique on the page: "issue-ENG-12-status"
agentbooleanFalse when the picker sits inside a component whose own contract already exposes this value (a list's cell editor): the picker then registers no contract, so agents see one entry, not two
namerequiredstringWhat the property is, for the filter's placeholder and screen readers: "Status"
optionsrequiredPickerOption[]The choices, each with a value, a label and a glyph.
selectedrequiredstring | nullThe picked option's value, or null for none. The caller keeps it.
emptyrequiredPickerOptionShown on the button when nothing is selected
compactbooleanAn icon-only button (a row in a list), or the full row with its label (a properties panel)
disabledbooleanThe value can't be changed or the list opened, as when the plan or a permission rules it out
readOnlybooleanThe list opens to show the choices, but none can be picked: someone else owns the value

Events

Picker events
EventPayloadDescription
Picked{ value: string }The person or an agent picked an option; store its value and pass it back as selected

Agent actions

What agents can do with Picker
ActionDescription
PickedOptionChoose one of the choices by its value (see page_query)

Accessibility

  • The trigger is a button that names the field and its value, such as "Status: In progress". Opening it puts focus in a filter field over the list.
  • Typing filters, the arrow keys move, Enter picks and Escape closes; the chosen option is marked checked.
  • Agents read the current value and the choices, and pick one by value.

Source