Item for Astro
Astro content rows for lists, linked summaries, and grouped details.
Installation
bunx --bun shadcn@latest add @gnostic/itemnpx shadcn@latest add @gnostic/itempnpm dlx shadcn@latest add @gnostic/itemCopy the files
src/components/ui/item/index.tssrc/components/ui/item/item-actions.astrosrc/components/ui/item/item-content.astrosrc/components/ui/item/item-description.astrosrc/components/ui/item/item-footer.astrosrc/components/ui/item/item-group.astrosrc/components/ui/item/item-header.astrosrc/components/ui/item/item-media.astrosrc/components/ui/item/item-separator.astrosrc/components/ui/item/item-title.astrosrc/components/ui/item/item.astro
Usage
import { Item, ItemContent, ItemDescription, ItemMedia, ItemTitle } from "@/components/ui/item"
---
import Heart from "@lucide/astro/icons/heart"
---
<Item>
<ItemMedia>
<Heart />
</ItemMedia>
<ItemContent>
<ItemTitle>Title</ItemTitle>
<ItemDescription>Description</ItemDescription>
</ItemContent>
</Item>
Composition
Arrange the parts as shown for an Item:
ItemGroup
└── Item
├── ItemHeader
├── ItemMedia
├── ItemContent
│ ├── ItemTitle
│ └── ItemDescription
├── ItemActions
└── ItemFooter
Notes
- Use
ItemContentto group the title and description instead of hand-rolled wrappers. - Passing
hrefturns the rootIteminto an anchor, which works well for list rows and navigational cards. - Use variants for emphasis changes before adding custom surface styles.
API Reference
Read the installed source for the complete prop types.
When to use Item
Use Item for a compact unit with media, title, description, and actions. Set href when the whole item is a link. Choose its size and surface variant to fit the density of the list.
Keyboard and behavior
Avoid nested links or buttons inside an Item rendered as an anchor. Use a non-link item when the row has several independent actions. Keep reading order logical when media and actions move on small screens.
Theme and layout
Default, outline, and muted variants share page tokens. Test long titles and descriptions without relying on fixed row heights. An item does not fetch data or select itself.