Skip to content

Select

Composable select runtime: Root owns value/open; Trigger/Value/Content/Item split rendering duties.

Runtime

State contracts come from @varo-ui/headless; rendered parts come from @varo-ui/h5/primitives or @varo-ui/weapp/primitives.

Demo

Package@varo-ui/headless

Installation

bash
pnpm add @varo-ui/headless @varo-ui/h5
# or
pnpm add @varo-ui/headless @varo-ui/weapp

Basic usage

Use the Demo panel above to switch H5 live preview and mini-program runtime contract/code.

Groups and readonly

Use SelectGroup/SelectLabel for grouping; readonly blocks changes while still showing the current value. Placement and motion stay in UI wrappers.

Parts

PartPurpose
SelectRootvalue/open state
SelectTriggerOpen entry
SelectValueCurrent value display
SelectContentOptions container
SelectGroupGroup
SelectLabelGroup label
SelectItemOne option

Props

SelectRoot

PropTypeDefaultDescription
valueunknownundefinedControlled value
defaultValueunknownundefinedUncontrolled initial value
openboolean | undefinedundefinedControlled open state
defaultOpenbooleanfalseUncontrolled initial open state
optionsarrayundefinedOptions data
placeholderstringundefinedPlaceholder
disabledbooleanfalseDisabled
readonlybooleanfalseRead only
multiplebooleanfalseMultiple semantics

SelectItem

PropTypeDescription
optionobjectOption object

Events

EventPayloadDescription
update:valueunknownValue sync
valueChangeunknownValue change
update:openbooleanOpen sync
openChangebooleanOpen change

Accessibility

  • Trigger opens the surface.
  • Item performs selection.
  • disabled/readonly must not change value.

Platform notes

  • H5 can preview open/select live.
  • Mini-program placement and portal strategy stay in the wrapper layer.