A simple item with title and description.
Installation
npx logic2b@next add itemUsage
import {
Item,
ItemActions,
ItemContent,
ItemDescription,
ItemMedia,
ItemTitle,
} from "@/components/ui/item"
import { Button } from "@/components/ui/button"
<Item variant="outline">
<ItemContent>
<ItemTitle>Basic Item</ItemTitle>
<ItemDescription>A simple item with title and description.</ItemDescription>
</ItemContent>
<ItemActions>
<Button variant="outline" size="sm">Action</Button>
</ItemActions>
</Item>
Pass asChild to render the item as its child element (e.g. an <a>) instead
of a div, so the whole row becomes a link while keeping the same layout.
Examples
Grouped, with separators and icon media
Wrap items in ItemGroup and drop an ItemSeparator between them for a
settings-style list. ItemMedia variant="icon" gives the leading icon a
muted square backdrop sized to match; variant="image" sizes and clips an
<img> the same way for avatar-style media.
Get notified about account activity.
Require a code at every sign-in.
Email me before a renewal charge.
Parts
| Component | Use for |
|---|---|
Item |
The row/card root — a flex container that wraps everything else. |
ItemGroup |
Visually groups items with neutral semantics; pair with ItemSeparator. |
ItemSeparator |
A horizontal rule between grouped items. |
ItemMedia |
Leading icon, image or avatar. |
ItemContent |
Wraps ItemTitle + ItemDescription; multiple ItemContents in one Item stay non-growing. |
ItemTitle |
The item’s title line. |
ItemDescription |
Supporting text, clamped to 2 lines. |
ItemActions |
Trailing buttons, switches or icons. |
ItemHeader / ItemFooter |
Optional full-width rows above/below the main content. |
Accessibility
ItemGroup is semantically neutral by default because not every composite
group is a list. For true list content, pass role="list" to ItemGroup and
role="listitem" to each Item. When an Item is interactive (a settings row
that navigates, for example), pass asChild and render a real <a> or
<button> as the child — don’t attach onClick to a bare <div>, which native
input methods and screen readers won’t treat as actionable. Give every trailing
icon button or switch its own accessible name.
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
<Item
variant="outline"
size="default"
>
<ItemContent>
<ItemTitle>Registry release</ItemTitle>
<ItemDescription>Versioned source and accessibility metadata are ready.</ItemDescription>
</ItemContent>
<ItemActions>
<span
className="rounded-full bg-muted px-2 py-1 text-xs"
>Ready</span>
</ItemActions>
</Item>Versioned source and accessibility metadata are ready.
API reference
Generated from the public TypeScript exports in src/ui/item.tsx.
Item
ComponentProps: React.ComponentProps<"div"> & VariantProps<typeof itemVariants> & { asChild?: boolean }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | null | "default" | "outline" | "muted" | No | "default" | — |
size | null | "default" | "sm" | No | "default" | — |
asChild | boolean | No | false | — |
ItemMedia
ComponentProps: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | null | "image" | "default" | "icon" | No | "default" | — |
ItemContent
ComponentProps: React.ComponentProps<"div">ItemActions
ComponentProps: React.ComponentProps<"div">ItemGroup
ComponentProps: React.ComponentProps<"div">ItemSeparator
ComponentProps: React.ComponentProps<typeof Separator>ItemTitle
ComponentProps: React.ComponentProps<"div">ItemDescription
ComponentProps: React.ComponentProps<"p">ItemHeader
ComponentProps: React.ComponentProps<"div">ItemFooter
ComponentProps: React.ComponentProps<"div">Accessibility contract
Machine-readable behavior and consumer responsibilities for item.
- Support
- Composition contract
- Pattern
- content item
- HTML div
Built-in semantics
- Preserves the semantics of nested headings, links and buttons without imposing a role.
Consumer responsibilities
- Choose list/listitem, article or link semantics at the composition boundary when the surrounding collection requires them.