A versatile component for displaying content with media, title, description, and actions.
Epicenter
Local-first, open source apps
A simple item with title and description.
The Item component is a straightforward flex container that can house nearly any type of content. Use it to display a title, description, and actions. Group it with the Item.Group component to create a list of items.
Installation
Copy and paste the following code into your project.
Usage
<script lang="ts">
import * as Item from "$lib/components/ui/item/index.js";
</script> <Item.Root>
<Item.Header>Item Header</Item.Header>
<Item.Media />
<Item.Content>
<Item.Title>Item</Item.Title>
<Item.Description>Item</Item.Description>
</Item.Content>
<Item.Actions />
<Item.Footer>Item Footer</Item.Footer>
</Item.Root> Item vs Field
Use Field if you need to display a form input such as a checkbox, input, radio, or select.
If you only need to display content such as a title, description, and actions, use Item.
Variant
Use the variant prop to change the visual style of the item.
Transparent background with no border.
Outlined style with a visible border.
Muted background for secondary content.
Size
Use the size prop to change the size of the item. Available sizes are default, sm, and xs.
The standard size for most use cases.
A compact size for dense layouts.
Icon
Use Item.Media with variant="icon" to display an icon.
New login detected from unknown device.
Avatar
You can use Item.Media with variant="avatar" to display an avatar.
Last seen 5 months ago
Invite your team to collaborate on this project.
Image
Use Item.Media with variant="image" to display an image.
Group
Use Item.Group to group related items together.
shadcn@vercel.com
maxleiter@vercel.com
evilrabbit@vercel.com
Header
Use Item.Header to add a header above the item content.
Everyday tasks and UI generation.
Advanced thinking or reasoning.
Open Source model for everyone.
Link
Use the child snippet to render the item as a link. The hover and focus states will be applied to the anchor element.
<Item.Root>
{#snippet child({ props })}
<a href="/dashboard" {...props}>
<Item.Media variant="icon">
<HomeIcon />
</Item.Media>
<Item.Content>
<Item.Title>Dashboard</Item.Title>
<Item.Description
>Overview of your account and activity.</Item.Description
>
</Item.Content>
</a>
{/snippet}
</Item.Root>