BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shadcn/item

item

shadcn/item
FreeComponent

shadcn publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by shadcn on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add item

Source

ui/item.tsxui.shadcn.com/r/styles/new-york/item.json
1import * as React from "react"
2import { Slot } from "@radix-ui/react-slot"
3import { cva, type VariantProps } from "class-variance-authority"
4
5import { cn } from "@/lib/utils"
6import { Separator } from "@/registry/new-york/ui/separator"
7
8function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
9 return (
10 <div
11 role="list"
12 data-slot="item-group"
13 className={cn("group/item-group flex flex-col", className)}
14 {...props}
15 />
16 )
17}
18
19function ItemSeparator({
20 className,
21 ...props
22}: React.ComponentProps<typeof Separator>) {
23 return (
24 <Separator
25 data-slot="item-separator"
26 orientation="horizontal"
27 className={cn("my-0", className)}
28 {...props}
29 />
30 )
31}
32
33const itemVariants = cva(
34 "group/item [a]:hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-ring/50 [a]:transition-colors flex flex-wrap items-center rounded-md border border-transparent text-sm outline-none transition-colors duration-100 focus-visible:ring-[3px]",
35 {
36 variants: {
37 variant: {
38 default: "bg-transparent",
39 outline: "border-border",
40 muted: "bg-muted/50",
41 },
42 size: {
43 default: "gap-4 p-4 ",
44 sm: "gap-2.5 px-4 py-3",
45 },
46 },
47 defaultVariants: {
48 variant: "default",
49 size: "default",
50 },
51 }
52)
53
54function Item({
55 className,
56 variant = "default",
57 size = "default",
58 asChild = false,
59 ...props
60}: React.ComponentProps<"div"> &
61 VariantProps<typeof itemVariants> & { asChild?: boolean }) {
62 const Comp = asChild ? Slot : "div"
63 return (
64 <Comp
65 data-slot="item"
66 data-variant={variant}
67 data-size={size}
68 className={cn(itemVariants({ variant, size, className }))}
69 {...props}
70 />
71 )
72}
73
74const itemMediaVariants = cva(
75 "flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none",
76 {
77 variants: {
78 variant: {
79 default: "bg-transparent",
80 icon: "bg-muted size-8 rounded-sm border [&_svg:not([class*='size-'])]:size-4",
81 image:
82 "size-10 overflow-hidden rounded-sm [&_img]:size-full [&_img]:object-cover",
83 },
84 },
85 defaultVariants: {
86 variant: "default",
87 },
88 }
89)
90
91function ItemMedia({
92 className,
93 variant = "default",
94 ...props
95}: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
96 return (
97// … truncated

What it pulls in

Other registry items

  • separator

Files it writes

  • ui/item.tsx

Facts

Registry
shadcn
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

Docs on shadcn ui.shadcn.com shadcn-ui/ui on GitHub Raw registry item This item as JSON

More from shadcn

All 62 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionshadcnComponentsFreeno deps
alertalertshadcnComponentsFreeno deps
alert-dialogalert-dialogshadcnComponentsFreeno deps
aspect-ratioaspect-ratioshadcnComponentsFreeno deps
attachmentattachmentshadcnComponentsFreeno deps
avataravatarshadcnComponentsFreeno deps
badgebadgeshadcnComponentsFreeno deps
breadcrumbbreadcrumbshadcnComponentsFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex