Installation
Add Component
Copy the code snippet below into you components folder.
Integrate Recipe
Integrate this recipe in to your Panda config.
Usage
Shortcuts
The SegmentGroup component also provides a set of shortcuts for common use cases.
SegmentGroupItems
The SegmentGroup.Items shortcut renders a list of items based on the items prop:
This might be more concise, if you don't need to customize the items:
Examples
Sizes
Use the size prop to change the size of the segmented group.
Fitted
Use the fitted prop to make the tabs fit the width of the container.
Vertical
By default, the segmented control is horizontal. Set the orientation prop to vertical to change the orientation of the segmented group.
Icon
Use icons inside the segmented group items.
Props
Root
| Prop | Default | Type | 
|---|---|---|
| size | 'md' | 'sm' | 'md' | 
| asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
| defaultValue | stringThe initial value of the checked radio when rendered. Use when you don't need to control the value of the radio group. | |
| disabled | booleanIf `true`, the radio group will be disabled | |
| form | stringThe associate form of the underlying input. | |
| id | stringThe unique identifier of the machine. | |
| ids | Partial<{
  root: string
  label: string
  indicator: string
  item: (value: string) => string
  itemLabel: (value: string) => string
  itemControl: (value: string) => string
  itemHiddenInput: (value: string) => string
}>The ids of the elements in the radio. Useful for composition. | |
| name | stringThe name of the input fields in the radio (Useful for form submission). | |
| onValueChange | (details: ValueChangeDetails) => voidFunction called once a radio is checked | |
| orientation | 'horizontal' | 'vertical'Orientation of the radio group | |
| readOnly | booleanWhether the checkbox is read-only | |
| value | stringThe controlled value of the radio group | 
Item
| Prop | Default | Type | 
|---|---|---|
| value* | string | |
| asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. | |
| disabled | boolean | |
| invalid | boolean |