- Label
- Icon label
- Field
- Form
- Frontmatter form
- Questionnaire
- Input
- Input group
- Input OTP
- Password input
- Password strength
- Code input
- Number field
- Tag input
- Textarea
- Checkbox
- Radio group
- Language toggle group
- Emoji appearance toggle group
- Emoji picker
- Avatar picker
- AI provider picker
- Select
- Native select
- Combobox
- Language combobox
- Slider
- Calendar
- Switch
- Alert
- Avatar
- Badge
- Card
- AI provider card
- Model info card
- Model list
- Empty
- Item
- Tree item
- File tree
- Icon media
- File type icon
- Font preview
- Image preview
- Kbd
- Table
- Data table
- Data table column header
- Chart
- Code Block
- Code card
- Markdown view
- Attachment
- Bubble
- Marker
- Message
- Chat message
- Chat suggestion item
- Message scroller
- Trace
- Progress
- Spinner
- Sonner
- Toast
- Unsaved changes toolbar
- Unsaved indicator
- Status indicator
- Permission card
- Separator
- Skeleton
- Animated grid pattern
- Meteors
Installation#
pnpm dlx shadcn@latest add @zui/button-groupThe CLI writes components/ui/button-group.tsx, installs Text,
Icon, Separator and Utils,
and adds @rn-primitives/slot and class-variance-authority.
Usage#
import { ChevronDown } from 'lucide-react-native';
import { Button } from '@/components/ui/button';
import { ButtonGroup, ButtonGroupSeparator } from '@/components/ui/button-group';
import { Icon } from '@/components/ui/icon';
import { Text } from '@/components/ui/text';<ButtonGroup aria-label="Save">
<Button>
<Text>Save</Text>
</Button>
<ButtonGroupSeparator />
<Button size="icon" aria-label="More save options">
<Icon as={ChevronDown} />
</Button>
</ButtonGroup>API reference#
ButtonGroup#
Takes every prop of React Native's View, plus:
| Prop | Type | Default |
|---|---|---|
orientation | 'horizontal' | 'vertical' | 'horizontal' |
It is a group; name it with aria-label. It is as wide as its children, and joins them: the edges two
children share are square, and the border between them is drawn once. A ButtonGroup of ButtonGroups spaces
them apart instead.
ButtonGroupText#
Takes every prop of React Native's View, plus asChild, which renders its single child in place of the
View with the cell's classes merged on. It draws a muted bordered cell; its Text child takes the cell's text,
and an Icon child is drawn at 16px.
ButtonGroupSeparator#
Takes every prop of Separator, vertical by default. It is drawn in the input colour and as tall as the group.
buttonGroupVariants#
The classes of each orientation.
Differences from upstream#
- Upstream joins the children with selectors on the group's children, which a device has no counterpart of.
The native ButtonGroup adds the joining classes to each direct child's
className, so the joined children are its direct children and each takesclassName, as Button, Input and ButtonGroupText do. - Upstream's ButtonGroupText takes a
renderprop. The native one takesasChild. - Upstream raises a focused child above its neighbours so its focus ring shows. The native items draw no focus ring, so there is nothing to raise.