A row that shows content with media and actions, such as a list entry, a notification, or a setting. Compose it from Item, ItemMedia, ItemContent, ItemTitle, ItemDescription, and ItemActions.
A simple item with a title and a description.
<script lang="ts">
import { Item, ItemContent, ItemTitle, ItemDescription, ItemActions } from "#lib/components/ui/item/index.js";
import { Button } from "#lib/components/ui/button/index.js";
</script>
<Item variant="outline">
<ItemContent>
<ItemTitle>Basic item</ItemTitle>
<ItemDescription>A simple item with a title and a description.</ItemDescription>
</ItemContent>
<ItemActions>
<Button variant="outline" size="sm">Action</Button>
</ItemActions>
</Item>pnx remote0 add https://plainsv.com/r/item.jsonItemMedia sits at the start and holds an icon, avatar, or image. ItemContent takes the room in the middle, with an ItemTitle and an ItemDescription clamped to two lines. ItemActions sits at the end. ItemHeader and ItemFooter take a full row above or below the content, since the item wraps.
Set variant to default, outline, or muted. Set variant on ItemMedia to icon for an icon in a bordered square, or image to crop an image to a square.
New login detected from an unknown device.
New login detected from an unknown device.
New login detected from an unknown device.
<Item variant="muted">
<ItemMedia variant="icon"><ShieldAlertIcon /></ItemMedia>
<ItemContent>...</ItemContent>
</Item>Set href to render the whole item as a link. Link items fill on hover and show a focus ring.
<Item variant="outline" href="/docs/components">
<ItemContent>
<ItemTitle>Visit the components</ItemTitle>
</ItemContent>
<ItemActions><ChevronRightIcon /></ItemActions>
</Item>Wrap items in ItemGroup to make a list; the group renders role="list" and each item role="listitem". Place ItemSeparator between items to divide them.
<ItemGroup>
{#each people as person, index (person.email)}
{#if index > 0}<ItemSeparator />{/if}
<Item>...</Item>
{/each}
</ItemGroup>Set size to xs, sm, md, or lg. The default is md, like the shadcn item, and the padding, gap, text size, and corner radius follow the size.
<Item variant="outline" size="sm">...</Item>Set rounded to xs through 4xl or pill to override the radius that follows size.
<Item variant="outline" rounded="3xl">...</Item>Item extends the native div attributes, or the a attributes when href is set. ItemDescription extends the p attributes, and every other part extends the div attributes.
interface ItemBaseProps {
/** `default` is transparent; `outline` draws a border; `muted` fills the background */
variant?: "default" | "outline" | "muted";
/** Padding, gap, and text size on the shared scale; defaults to `md` */
size?: UiSize;
/** Corner radius; follows `size` when omitted. `pill` is a true pill that can clip the content, so use `3xl` or `4xl` to stay round */
rounded?: UiRounded;
}
type Props = ItemBaseProps & ((CompPropsWithChild<"div"> & { href?: undefined }) | (CompPropsWithChild<"a"> & { href: string }));
interface MediaProps extends CompPropsWithChild<"div"> {
/** `default` shows the media as is; `icon` puts an icon in a bordered square; `image` crops an image to a square */
variant?: "default" | "icon" | "image";
}