Skip to content

Tabs

Tabs runtime: Root owns the active value; Trigger/Content associate through the same value.

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
Panel A

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.

Controlled unique values

Trigger/Content values must stay unique inside one TabsRoot; H5 automatic mode supports arrow-key movement.

Parts

PartPurpose
TabsRootActive value and orientation
TabsListTrigger container
TabsTriggerOne tab title
TabsContentMatching panel

Props

TabsRoot

PropTypeDefaultDescription
valuestring | number | undefinedundefinedControlled active value
defaultValuestring | numberundefinedUncontrolled initial value
orientationstringundefinedOrientation semantics
disabledbooleanfalseDisables the whole tabs root
idstringundefinedAssociation id prefix
asstring'div'Root element tag

TabsTrigger / TabsContent

PropTypeDescription
valuestring | numberUnique value associated with Root
disabledbooleanTrigger-only disabled flag

Events

EventPayloadDescription
update:valuestring | numberControlled sync
valueChangestring | numberActive value change

Accessibility

  • Value drives both state and panel association.
  • H5 supports arrows/Home/End.
  • Weapp keeps ARIA and value association without browser focus simulation.

Platform notes

  • H5 can demonstrate keyboard behavior.
  • Mini-program docs show a runtime contract, not a fake device preview.