Select

Chooses one option from a native picker.

  • Native host
  • In the first release
import { Select, selectPrimitive } from "nitro-ui-sdk/select";
HeroUI Native
SelectWheelPicker (Pro)
Expo UI
Picker
  • Select example screen, light appearance
    Light
  • Select example screen, dark appearance
    Dark
On this page

Select commits one option from a list through a platform picker. Use RadioGroup when a short list should stay visible.

Anatomy

import { Select } from "nitro-ui-sdk/select";

<Select.Root label="Priority" placeholder="Choose" doneLabel="Done" cancelLabel="Cancel" items={[]}>
  <Select.Label />
  <Select.Trigger />
  <Select.Value />
  <Select.Hint />
</Select.Root>;
Part Description
Root Owns the selected key, picker session and field layout.
Label Visible field label.
Trigger Native button that opens the picker.
Value Text mirror of the selected option or placeholder.
Hint Optional visible help.
Item Text part for custom composition. The native list reads Root items.

Usage

import { Select } from "nitro-ui-sdk/select";

<Select.Root
  label="Priority"
  placeholder="Choose a priority"
  doneLabel="Done"
  cancelLabel="Cancel"
  defaultValue="normal"
  items={[{ key: "normal", label: "Normal" }, { key: "high", label: "High" }]}
/>;

Variants and sizes

field draws a bordered trigger. compact draws a quieter surface. Sizes are sm, md and lg, with md as the default. Each trigger maintains a minimum 44 pt hit area.

States

Set disabled to prevent opening or changing a selection. Individual disabled items cannot be selected. A null value shows the placeholder. The active field draws a focus border.

Controlled

import { useState } from "react";
import { Select } from "nitro-ui-sdk/select";

export function PriorityField() {
  const [value, setValue] = useState<string | null>(null);
  return <Select.Root label="Priority" placeholder="Choose" doneLabel="Done" cancelLabel="Cancel"
    items={[{ key: "high", label: "High" }]} value={value} onValueChange={setValue} />;
}

Use defaultValue for an uncontrolled selection. The callback runs when a choice is confirmed. Declining with details.preventDefault() or keeping the controlled key unchanged keeps the picker open.

Props

Root

Prop Type Default Description
label string required Visible label and spoken field name.
placeholder string required Value text until a known key is selected.
hint string — Visible help and accessibility hint.
doneLabel / cancelLabel string required Localized picker actions.
items readonly SelectItem[] required Unique string keys, labels and optional disabled flags.
value / defaultValue string or null null Controlled or initial selected key.
onValueChange (key, details) => void — Confirmation callback with action source.
disabled boolean false Blocks selection.
variant SelectVariant field Trigger appearance.
size SelectSize md Trigger size.
styles PartStyles — Per-part style resolvers.
api Controller — Controller binding.
agentId string — Stable agent identity.
children ReactNode Label, Trigger, Hint Custom anatomy.

Trigger

Prop Type Default Description
part SelectPart trigger Style part to resolve.

Label, Value, Hint, Item

Prop Type Default Description
part SelectPart component part Style part to resolve.
children string Root text Override visible text. Item requires children.

Controller API

import { useState } from "react";
import { Select, selectPrimitive } from "nitro-ui-sdk/select";

export function PriorityField() {
  const [api] = useState(selectPrimitive.createApi);
  return <Select.Root api={api} label="Priority" placeholder="Choose" doneLabel="Done" cancelLabel="Cancel" items={[]} />;
}
Action Signature Result
open (source?) => ActionStatus Starts a picker session.
close (source?) => ActionStatus Discards the pending selection and closes.
select (key, source?) => Promise Confirms an enabled choice and settles controlled updates.

Styles

import { Select } from "nitro-ui-sdk/select";

<Select.Root label="Priority" placeholder="Choose" doneLabel="Done" cancelLabel="Cancel" items={[]}
  styles={{ trigger: ({ tokens }) => ({ style: { cornerRadius: tokens.radius.card } }) }} />;

Resolvers receive the variant, size, tokens and the open, disabled and value state fields.

Accessibility

The native trigger exposes the label, current selection, disabled state and optional hint. The picker announces its title on entry and restores field focus on dismissal.

Agent API

Action Arguments Notes
open None Opens from the combobox.
select Option key string Confirms an enabled option from the foreground listbox.
close None Dismisses the listbox.

Platform notes

iOS Android
Implementation Native button and UIPickerView with confirmation. Native button and an alert with a single-choice list.
Verification iOS harness. Implementation written. Build and runtime verification require an Android NDK.