- 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/itemThe CLI writes components/ui/item.tsx, installs Text,
Icon, Separator and Utils,
and adds @rn-primitives/slot and class-variance-authority.
Usage#
import { ShieldAlert } from 'lucide-react-native';
import { Button } from '@/components/ui/button';
import { Icon } from '@/components/ui/icon';
import { Item, ItemActions, ItemContent, ItemDescription, ItemMedia, ItemTitle } from '@/components/ui/item';
import { Text } from '@/components/ui/text';<Item variant="outline">
<ItemMedia variant="icon">
<Icon as={ShieldAlert} />
</ItemMedia>
<ItemContent>
<ItemTitle>Two-factor authentication</ItemTitle>
<ItemDescription>Protect your account with a code from your phone.</ItemDescription>
</ItemContent>
<ItemActions>
<Button size="sm" variant="outline">
<Text>Enable</Text>
</Button>
</ItemActions>
</Item>To make the whole row take a press, give it asChild and a Pressable child:
<Item asChild>
<Pressable role="button" onPress={openProfile}>
<ItemContent>
<ItemTitle>Profile</ItemTitle>
</ItemContent>
</Pressable>
</Item>API reference#
Item#
Takes every prop of React Native's View, plus:
| Prop | Type | Default |
|---|---|---|
variant | 'default' | 'outline' | 'muted' | 'default' |
size | 'default' | 'sm' | 'xs' | 'default' |
asChild | boolean | false |
default draws no border, outline a border, and muted a muted background. size sets the spacing; at
xs the description is smaller. With asChild, the Item renders its single child in place of the View, with
the item's props and classes merged on.
ItemMedia#
Takes every prop of React Native's View, plus:
| Prop | Type | Default |
|---|---|---|
variant | 'default' | 'icon' | 'image' | 'default' |
icon draws an Icon child at 16px. image clips its child to a rounded square that shrinks with the Item's
size; size the image size-full. The media is centred, or aligned to the top while the Item holds an
ItemDescription.
ItemContent#
Takes every prop of React Native's View, and takes the width the media and actions leave.
ItemTitle, ItemDescription#
Each takes every prop of Text. The title is one line; the description is muted and at most two lines.
ItemActions, ItemHeader, ItemFooter#
Each takes every prop of React Native's View. ItemActions lays its controls out in a row. ItemHeader and
ItemFooter each take a line of their own and spread their children to both ends.
ItemGroup, ItemSeparator#
ItemGroup takes every prop of React Native's View and is a list, spaced by the size of the Items directly
inside it. ItemSeparator takes every prop of Separator and draws a
horizontal rule between two Items.
Differences from upstream#
- Upstream's Item takes a
renderprop. The native one takesasChild. - Upstream's ItemTitle is a box that can hold a badge beside its text. The native ItemTitle is a Text, so put a badge beside it in a row instead.
- Upstream sizes an
imginside image media with a child selector. Size the native imagesize-fullyourself. - Upstream colours an Item that is a link when hovered. A touch screen has no hover, and the native Item draws no pressed colour.