Item
Lays out one row of a list or a menu: a glyph, a name with a line under it, and its actions.
Variants
Supported configurations for this component.
States
Interaction states covered by the API and the style contract.
Variants
5 examplesStates
6 examplesAdd to your project
One command adds this component to your project.
Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.
npx shadcn@latest add @aicanvas/••••••••••••Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").
Props
Every prop this component accepts. Any other prop is forwarded to the underlying element.
Item
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'default'|'outline' | 'default' | `default` is the frameless row of a menu or list (spacing[2] padding, transparent); `outline` is a row on its own (hairline border.subtle, surface.raised ground, spacing[3] padding). |
| size | 'sm'|'md' | 'md' | Rung: sm 12px title, 16px glyph, 28px minimum height; md 14px title, 18px glyph, 32px minimum height. The description is 12px at both. |
| asChild | boolean | false | Renders via Radix Slot, merging the row onto its single child (a button, link, menuitemradio, option). A child that is interactive takes the row states: hover surface.hover, pressed and aria-checked surface.active, aria-selected or data-active surface.hover, the inset focus ring. |
| render | React.ReactElement | - | The same as asChild, in the Base UI form some installers rewrite asChild into: the row renders this element with its props merged onto it, and the row's children, when given, become the element's children. |
| children | React.ReactNode | - | ItemMedia, ItemContent and ItemActions, in that order. |
| className | string | - | Extra classes merged onto the row. |
| style | React.CSSProperties | - | Inline styles merged onto the row. Leave background to the row: its states depend on it. |
ItemMedia
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'plain'|'icon' | 'plain' | `plain` is the bare glyph in text.muted at the rung's icon size (16 sm / 18 md); `icon` is a 32px box (spacing[8]) with a hairline border.subtle frame and an 18px glyph. |
| children | React.ReactNode | - | A Phosphor icon element (sized here, any `size` prop is overridden) or an Avatar. |
| className | string | - | Extra classes merged onto the media slot. |
| style | React.CSSProperties | - | Inline styles merged onto the media slot. |
ItemPart
| Prop | Type | Default | Description |
|---|---|---|---|
| children | React.ReactNode | - | Content rendered inside the component. |
| className | string | - | Extra classes merged onto the part. |
| style | React.CSSProperties | - | Inline styles merged onto the part. |