Tally UI
Primitives

Select

A dropdown control for picking a single option from a list.

Import

import { Select } from '@tallyui/primitives';

Usage

<Select.Root value={value} onValueChange={setValue}>
  <Select.Trigger>
    <Select.Value placeholder="Choose a size" />
  </Select.Trigger>
  <Select.Portal>
    <Select.Overlay />
    <Select.Content sideOffset={4}>
      <Select.Item value="small" label="Small">
        <Select.ItemText />
        <Select.ItemIndicator><CheckIcon /></Select.ItemIndicator>
      </Select.Item>
      <Select.Item value="medium" label="Medium">
        <Select.ItemText />
        <Select.ItemIndicator><CheckIcon /></Select.ItemIndicator>
      </Select.Item>
    </Select.Content>
  </Select.Portal>
</Select.Root>

Components

Select.Root

Manages the selected value and open/closed state. Does not render a DOM element.

PropTypeDefaultDescription
valueOptionControlled selected option ({ value: string; label: string })
defaultValueOptionInitial option (uncontrolled)
onValueChange(option: Option) => voidCalled when selection changes
openbooleanControlled open state
defaultOpenbooleanfalseInitial open state (uncontrolled)
onOpenChange(open: boolean) => voidCalled when open state changes
disabledbooleanfalsePrevents interaction

Select.Trigger

A pressable that opens the select dropdown.

PropTypeDefaultDescription
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native PressableProps.

Select.Value

Displays the selected option's label, or a placeholder when nothing is selected.

PropTypeDefaultDescription
placeholderstringText to show when no value is selected
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native TextProps.

Select.Portal

Renders children into a portal.

PropTypeDefaultDescription
forceMounttrueAlways mount portal content
hostNamestringTarget portal host name

Select.Overlay

An optional backdrop behind the dropdown.

PropTypeDefaultDescription
closeOnPressbooleantrueWhether pressing the overlay closes the select
forceMounttrueAlways render the overlay
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native PressableProps.

Select.Content

The positioned dropdown panel. Accepts all PositionedContentProps.

PropTypeDefaultDescription
side'top' | 'bottom''bottom'Preferred side relative to the trigger
sideOffsetnumber0Distance from the trigger
align'start' | 'center' | 'end''center'Alignment along the trigger
avoidCollisionsbooleantrueShift to stay within the viewport
forceMounttrueAlways render the content
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native ViewProps.

Select.Item

A selectable option inside the dropdown.

PropTypeDefaultDescription
valuestringrequiredThe value for this option
labelstringrequiredThe display label for this option
closeOnPressbooleantrueWhether selecting closes the dropdown
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native PressableProps.

Select.ItemText

Displays the item's label text.

PropTypeDefaultDescription
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native TextProps.

Select.ItemIndicator

Renders when the parent Item is selected.

PropTypeDefaultDescription
forceMounttrueAlways render regardless of selection
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native ViewProps.

Select.Group

Groups related items together.

PropTypeDefaultDescription
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native ViewProps.

Select.Label

A label for a Group.

PropTypeDefaultDescription
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native TextProps.

Select.Separator

A visual divider between items or groups.

PropTypeDefaultDescription
decorativebooleanfalseRemoves from accessibility tree
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native ViewProps.

Accessibility

  • Role: combobox on Trigger, listbox on Content, option on each Item
  • ARIA: aria-expanded, aria-selected, aria-disabled
  • Keyboard navigation through options on web

On this page