The Item one | Community Components | 21st
The Item one
Here is The Item components
Vite + React + TS
User List Code
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
import { Button } from '@/components/ui/the-item-one'
import {
Item,
ItemActions,
ItemContent,
ItemDescription,
ItemGroup,
ItemMedia,
ItemTitle,
} from '@/components/ui/item'
const users = [
{
name: 'Sarah Chen',
role: 'Product designer',
initials: 'SC',
avatar:
'https://images.unsplash.com/photo-1494790108377-be9c29b29330?auto=format&fit=crop&w=200&q=80',
},
{
name: 'Marcus Lee',
role: 'Engineering manager',
initials: 'ML',
avatar:
'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=200&q=80',
},
{
name: 'Priya Patel',
role: 'Data scientist',
initials: 'PP',
avatar:
'https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&w=200&q=80',
},
]
export default function Item12() {
return (
<ItemGroup className="w-full max-w-md">
{users.map((user) => (
<Item key={user.name} variant="outline">
<ItemMedia variant="image">
<Avatar className="size-full rounded-sm">
<AvatarImage src={user.avatar} alt="" />
<AvatarFallback>{user.initials}</AvatarFallback>
</Avatar>
</ItemMedia>
<ItemContent>
<ItemTitle>{user.name}</ItemTitle>
<ItemDescription>{user.role}</ItemDescription>
</ItemContent>
<ItemActions>
<Button variant="outline" size="sm">
Follow
</Button>
</ItemActions>
</Item>
))}
</ItemGroup>
)
}
Examples of Item Variants
Vite + React + TS
Two-factor authentication
import {
Item,
ItemContent,
ItemDescription,
ItemTitle,
} from '@/components/ui/item'
export default function Item02() {
return (
<Item className="w-full max-w-md">
<ItemContent>
<ItemTitle>Two-factor authentication</ItemTitle>
<ItemDescription>
Add an extra layer of security to your account.
</ItemDescription>
</ItemContent>
</Item>
)
}
Item Variants
Default
- Borderless, transparent background.
Outline
- Visible border, no fill.
Muted
- Soft muted background, no border.
Sizes
Default size
- Comfortable padding and gap.
Small size
- Denser rows for lists.
import {
Item,
ItemContent,
ItemDescription,
ItemTitle,
} from '@/components/ui/item'
export default function Item04() {
return (
<div className="flex w-full max-w-md flex-col gap-3">
<Item variant="outline" size="default">
<ItemContent>
<ItemTitle>Default size</ItemTitle>
<ItemDescription>Comfortable padding and gap.</ItemDescription>
</ItemContent>
</Item>
<Item variant="outline" size="sm">
<ItemContent>
<ItemTitle>Small size</ItemTitle>
<ItemDescription>Denser rows for lists.</ItemDescription>
</ItemContent>
</Item>
</div>
)
}
Notifications
Examples of item notifications include team interactions and updates:
Notification List Code:
const notifications = [
{
icon: GitPullRequestIcon,
title: 'Marcus requested review',
description: 'PR #482 · Refactor billing module',
time: '2m ago',
unread: true,
},
{
icon: AtSignIcon,
title: 'Sarah mentioned you',
description: '"Can you take a look at the spec?"',
time: '1h ago',
unread: true,
},
{
icon: MessageSquareIcon,
title: 'New comment on RFC-12',
description: 'Priya: "+1 on the staged rollout plan."',
time: 'Yesterday',
unread: false,
},
]
export default function Item13() {
return (
<ItemGroup className="w-full max-w-md">
{notifications.map((n) => (
<Item key={n.title} variant="outline">
<ItemMedia variant="icon">
<n.icon />
</ItemMedia>
<ItemContent>
<ItemTitle>
{n.title}
{n.unread && (
<span
aria-label="Unread"
className="bg-primary inline-block size-1.5 rounded-full"
/>
)}
</ItemTitle>
<ItemDescription>{n.description}</ItemDescription>
</ItemContent>
<ItemFooter className="basis-auto">
<span className="text-muted-foreground text-xs">{n.time}</span>
</ItemFooter>
</Item>
))}
</ItemGroup>
)
}