For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
FrakmentFrakment

Item

A flexible row for grouping media, content, and actions.

AC
Aria Chen
aria@example.com
Admin
BO
Ben Ortiz
jane@example.com
CP
Cleo Park
cara@example.com
Member
item.tsx
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";
import * as React from "react";

import { cn } from "@/lib/utils";

const itemVariants = cva(
  "group/item flex w-full flex-wrap items-center gap-3 rounded-lg border px-4 py-3 text-sm transition-colors",
  {
    defaultVariants: {
      variant: "default",
    },
    variants: {
      variant: {
        default: "border-border bg-card text-card-foreground",
        muted: "bg-muted text-foreground border-transparent",
        outline: "border-border bg-transparent",
      },
    },
  }
);

type ItemProps = React.ComponentPropsWithoutRef<"div"> &
  VariantProps<typeof itemVariants> & {
    as?: React.ElementType;
    asChild?: boolean;
  };

function Item({
  as,
  asChild,
  children,
  className,
  variant,
  ...props
}: ItemProps) {
  const mergedClass = cn(itemVariants({ variant }), className);
  if (asChild && React.isValidElement(children)) {
    const child = children as React.ReactElement<{ className?: string }>;
    return React.cloneElement(child, {
      ...props,
      className: cn(mergedClass, child.props.className),
      "data-slot": "item",
      "data-variant": variant,
    } as never);
  }
  const Comp = (as ?? "div") as React.ElementType;
  return (
    <Comp
      className={mergedClass}
      data-slot="item"
      data-variant={variant}
      {...props}
    >
      {children}
    </Comp>
  );
}

function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex flex-col gap-2", className)}
      data-slot="item-group"
      {...props}
    />
  );
}

function ItemMedia({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn(
        "flex shrink-0 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
        className
      )}
      data-slot="item-media"
      {...props}
    />
  );
}

function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex min-w-0 flex-1 flex-col gap-0.5", className)}
      data-slot="item-content"
      {...props}
    />
  );
}

function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("truncate text-sm leading-tight font-medium", className)}
      data-slot="item-title"
      {...props}
    />
  );
}

function ItemDescription({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("text-muted-foreground text-sm", className)}
      data-slot="item-description"
      {...props}
    />
  );
}

function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex shrink-0 items-center gap-2", className)}
      data-slot="item-actions"
      {...props}
    />
  );
}

export {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemGroup,
  ItemMedia,
  ItemTitle,
};

Item is a flexible row primitive for grouping media, content, and actions. Use it for settings lists, activity feeds, user rows, or any horizontal layout with a leading visual and trailing controls.

Installation

Usage

item.tsx
import { Item, ItemContent, ItemMedia, ItemTitle } from "@/components/ui/item";
 
<DocsBaseSwitcher base="web" component="item" className="mb-6" />
item.tsx
<Item>
  <ItemMedia>JS</ItemMedia>
  <ItemContent>
    <ItemTitle>Jane Smith</ItemTitle>
  </ItemContent>
</Item>

Composition

Item
├── ItemMedia
├── ItemContent
│   ├── ItemTitle
│   └── ItemDescription
└── ItemActions

Variants

Three styles: default (bordered card), outline (transparent with border), muted (soft background, no border).

default
Default row
outline
Outline row
muted
Muted row
item.tsx
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";
import * as React from "react";

import { cn } from "@/lib/utils";

const itemVariants = cva(
  "group/item flex w-full flex-wrap items-center gap-3 rounded-lg border px-4 py-3 text-sm transition-colors",
  {
    defaultVariants: {
      variant: "default",
    },
    variants: {
      variant: {
        default: "border-border bg-card text-card-foreground",
        muted: "bg-muted text-foreground border-transparent",
        outline: "border-border bg-transparent",
      },
    },
  }
);

type ItemProps = React.ComponentPropsWithoutRef<"div"> &
  VariantProps<typeof itemVariants> & {
    as?: React.ElementType;
    asChild?: boolean;
  };

function Item({
  as,
  asChild,
  children,
  className,
  variant,
  ...props
}: ItemProps) {
  const mergedClass = cn(itemVariants({ variant }), className);
  if (asChild && React.isValidElement(children)) {
    const child = children as React.ReactElement<{ className?: string }>;
    return React.cloneElement(child, {
      ...props,
      className: cn(mergedClass, child.props.className),
      "data-slot": "item",
      "data-variant": variant,
    } as never);
  }
  const Comp = (as ?? "div") as React.ElementType;
  return (
    <Comp
      className={mergedClass}
      data-slot="item"
      data-variant={variant}
      {...props}
    >
      {children}
    </Comp>
  );
}

function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex flex-col gap-2", className)}
      data-slot="item-group"
      {...props}
    />
  );
}

function ItemMedia({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn(
        "flex shrink-0 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
        className
      )}
      data-slot="item-media"
      {...props}
    />
  );
}

function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex min-w-0 flex-1 flex-col gap-0.5", className)}
      data-slot="item-content"
      {...props}
    />
  );
}

function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("truncate text-sm leading-tight font-medium", className)}
      data-slot="item-title"
      {...props}
    />
  );
}

function ItemDescription({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("text-muted-foreground text-sm", className)}
      data-slot="item-description"
      {...props}
    />
  );
}

function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex shrink-0 items-center gap-2", className)}
      data-slot="item-actions"
      {...props}
    />
  );
}

export {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemGroup,
  ItemMedia,
  ItemTitle,
};

With media

Put an icon, avatar, or badge in ItemMedia. Icons without a size-* class are auto-sized to 16px.

A

Aria Chen

B

Ben Ortiz

C

Cleo Park
item.tsx
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";
import * as React from "react";

import { cn } from "@/lib/utils";

const itemVariants = cva(
  "group/item flex w-full flex-wrap items-center gap-3 rounded-lg border px-4 py-3 text-sm transition-colors",
  {
    defaultVariants: {
      variant: "default",
    },
    variants: {
      variant: {
        default: "border-border bg-card text-card-foreground",
        muted: "bg-muted text-foreground border-transparent",
        outline: "border-border bg-transparent",
      },
    },
  }
);

type ItemProps = React.ComponentPropsWithoutRef<"div"> &
  VariantProps<typeof itemVariants> & {
    as?: React.ElementType;
    asChild?: boolean;
  };

function Item({
  as,
  asChild,
  children,
  className,
  variant,
  ...props
}: ItemProps) {
  const mergedClass = cn(itemVariants({ variant }), className);
  if (asChild && React.isValidElement(children)) {
    const child = children as React.ReactElement<{ className?: string }>;
    return React.cloneElement(child, {
      ...props,
      className: cn(mergedClass, child.props.className),
      "data-slot": "item",
      "data-variant": variant,
    } as never);
  }
  const Comp = (as ?? "div") as React.ElementType;
  return (
    <Comp
      className={mergedClass}
      data-slot="item"
      data-variant={variant}
      {...props}
    >
      {children}
    </Comp>
  );
}

function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex flex-col gap-2", className)}
      data-slot="item-group"
      {...props}
    />
  );
}

function ItemMedia({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn(
        "flex shrink-0 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
        className
      )}
      data-slot="item-media"
      {...props}
    />
  );
}

function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex min-w-0 flex-1 flex-col gap-0.5", className)}
      data-slot="item-content"
      {...props}
    />
  );
}

function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("truncate text-sm leading-tight font-medium", className)}
      data-slot="item-title"
      {...props}
    />
  );
}

function ItemDescription({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("text-muted-foreground text-sm", className)}
      data-slot="item-description"
      {...props}
    />
  );
}

function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex shrink-0 items-center gap-2", className)}
      data-slot="item-actions"
      {...props}
    />
  );
}

export {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemGroup,
  ItemMedia,
  ItemTitle,
};

With description

Add ItemDescription below ItemTitle for a secondary line.

Deployed v1.2.3
2 minutes ago
Ran migrations
14 minutes ago
Merged PR #42
1 hour ago
item.tsx
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";
import * as React from "react";

import { cn } from "@/lib/utils";

const itemVariants = cva(
  "group/item flex w-full flex-wrap items-center gap-3 rounded-lg border px-4 py-3 text-sm transition-colors",
  {
    defaultVariants: {
      variant: "default",
    },
    variants: {
      variant: {
        default: "border-border bg-card text-card-foreground",
        muted: "bg-muted text-foreground border-transparent",
        outline: "border-border bg-transparent",
      },
    },
  }
);

type ItemProps = React.ComponentPropsWithoutRef<"div"> &
  VariantProps<typeof itemVariants> & {
    as?: React.ElementType;
    asChild?: boolean;
  };

function Item({
  as,
  asChild,
  children,
  className,
  variant,
  ...props
}: ItemProps) {
  const mergedClass = cn(itemVariants({ variant }), className);
  if (asChild && React.isValidElement(children)) {
    const child = children as React.ReactElement<{ className?: string }>;
    return React.cloneElement(child, {
      ...props,
      className: cn(mergedClass, child.props.className),
      "data-slot": "item",
      "data-variant": variant,
    } as never);
  }
  const Comp = (as ?? "div") as React.ElementType;
  return (
    <Comp
      className={mergedClass}
      data-slot="item"
      data-variant={variant}
      {...props}
    >
      {children}
    </Comp>
  );
}

function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex flex-col gap-2", className)}
      data-slot="item-group"
      {...props}
    />
  );
}

function ItemMedia({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn(
        "flex shrink-0 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
        className
      )}
      data-slot="item-media"
      {...props}
    />
  );
}

function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex min-w-0 flex-1 flex-col gap-0.5", className)}
      data-slot="item-content"
      {...props}
    />
  );
}

function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("truncate text-sm leading-tight font-medium", className)}
      data-slot="item-title"
      {...props}
    />
  );
}

function ItemDescription({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("text-muted-foreground text-sm", className)}
      data-slot="item-description"
      {...props}
    />
  );
}

function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex shrink-0 items-center gap-2", className)}
      data-slot="item-actions"
      {...props}
    />
  );
}

export {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemGroup,
  ItemMedia,
  ItemTitle,
};

With actions

Add ItemActions as the last child for a trailing button, badge, or amount.

Pro plan
Billed monthly
$20/mo
Team plan
Billed annually
$200/yr
item.tsx
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";
import * as React from "react";

import { cn } from "@/lib/utils";

const itemVariants = cva(
  "group/item flex w-full flex-wrap items-center gap-3 rounded-lg border px-4 py-3 text-sm transition-colors",
  {
    defaultVariants: {
      variant: "default",
    },
    variants: {
      variant: {
        default: "border-border bg-card text-card-foreground",
        muted: "bg-muted text-foreground border-transparent",
        outline: "border-border bg-transparent",
      },
    },
  }
);

type ItemProps = React.ComponentPropsWithoutRef<"div"> &
  VariantProps<typeof itemVariants> & {
    as?: React.ElementType;
    asChild?: boolean;
  };

function Item({
  as,
  asChild,
  children,
  className,
  variant,
  ...props
}: ItemProps) {
  const mergedClass = cn(itemVariants({ variant }), className);
  if (asChild && React.isValidElement(children)) {
    const child = children as React.ReactElement<{ className?: string }>;
    return React.cloneElement(child, {
      ...props,
      className: cn(mergedClass, child.props.className),
      "data-slot": "item",
      "data-variant": variant,
    } as never);
  }
  const Comp = (as ?? "div") as React.ElementType;
  return (
    <Comp
      className={mergedClass}
      data-slot="item"
      data-variant={variant}
      {...props}
    >
      {children}
    </Comp>
  );
}

function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex flex-col gap-2", className)}
      data-slot="item-group"
      {...props}
    />
  );
}

function ItemMedia({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn(
        "flex shrink-0 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
        className
      )}
      data-slot="item-media"
      {...props}
    />
  );
}

function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex min-w-0 flex-1 flex-col gap-0.5", className)}
      data-slot="item-content"
      {...props}
    />
  );
}

function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("truncate text-sm leading-tight font-medium", className)}
      data-slot="item-title"
      {...props}
    />
  );
}

function ItemDescription({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("text-muted-foreground text-sm", className)}
      data-slot="item-description"
      {...props}
    />
  );
}

function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex shrink-0 items-center gap-2", className)}
      data-slot="item-actions"
      {...props}
    />
  );
}

export {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemGroup,
  ItemMedia,
  ItemTitle,
};

In context

Combine with Spinner for a live processing row.

Processing payment...
$100.00
item.tsx
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";
import * as React from "react";

import { cn } from "@/lib/utils";

const itemVariants = cva(
  "group/item flex w-full flex-wrap items-center gap-3 rounded-lg border px-4 py-3 text-sm transition-colors",
  {
    defaultVariants: {
      variant: "default",
    },
    variants: {
      variant: {
        default: "border-border bg-card text-card-foreground",
        muted: "bg-muted text-foreground border-transparent",
        outline: "border-border bg-transparent",
      },
    },
  }
);

type ItemProps = React.ComponentPropsWithoutRef<"div"> &
  VariantProps<typeof itemVariants> & {
    as?: React.ElementType;
    asChild?: boolean;
  };

function Item({
  as,
  asChild,
  children,
  className,
  variant,
  ...props
}: ItemProps) {
  const mergedClass = cn(itemVariants({ variant }), className);
  if (asChild && React.isValidElement(children)) {
    const child = children as React.ReactElement<{ className?: string }>;
    return React.cloneElement(child, {
      ...props,
      className: cn(mergedClass, child.props.className),
      "data-slot": "item",
      "data-variant": variant,
    } as never);
  }
  const Comp = (as ?? "div") as React.ElementType;
  return (
    <Comp
      className={mergedClass}
      data-slot="item"
      data-variant={variant}
      {...props}
    >
      {children}
    </Comp>
  );
}

function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex flex-col gap-2", className)}
      data-slot="item-group"
      {...props}
    />
  );
}

function ItemMedia({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn(
        "flex shrink-0 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
        className
      )}
      data-slot="item-media"
      {...props}
    />
  );
}

function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex min-w-0 flex-1 flex-col gap-0.5", className)}
      data-slot="item-content"
      {...props}
    />
  );
}

function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("truncate text-sm leading-tight font-medium", className)}
      data-slot="item-title"
      {...props}
    />
  );
}

function ItemDescription({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("text-muted-foreground text-sm", className)}
      data-slot="item-description"
      {...props}
    />
  );
}

function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex shrink-0 items-center gap-2", className)}
      data-slot="item-actions"
      {...props}
    />
  );
}

export {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemGroup,
  ItemMedia,
  ItemTitle,
};

In Context

Settings row

AR
Jane Doe
john@example.com
item-settings.tsx
"use client";

import { Button } from "@/components/ui/button";
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemMedia,
  ItemTitle,
} from "@/components/ui/item";

export function ItemSettings() {
  return (
    <div className="mx-auto w-full max-w-sm">
      <Item variant="outline">
        <ItemMedia>
          <span className="bg-muted flex size-8 items-center justify-center rounded-full text-xs font-medium">
            AR
          </span>
        </ItemMedia>
        <ItemContent>
          <ItemTitle>Jane Doe</ItemTitle>
          <ItemDescription>john@example.com</ItemDescription>
        </ItemContent>
        <ItemActions>
          <Button size="sm" variant="outline">
            Edit
          </Button>
        </ItemActions>
      </Item>
    </div>
  );
}

API Reference

Item

PropTypeDefaultDescription
variant
defaultoutlinemuted
defaultVisual style of the row.

ItemMedia / ItemContent / ItemTitle / ItemDescription / ItemActions

Extend React.ComponentProps<"div">. Each maps to a data-slot attribute for CSS targeting.

As prop

Item also accepts an as prop to render a custom element such as <a> or <li>.

Data Attributes

AttributeValues
data-slotitem, item-group, item-media, item-content, item-title, item-description, item-actions
data-variantdefault | outline | muted
data-sizedefault | sm

Accessibility

  • Item renders a <div> — for interactive rows, use as with <a> or <button> so keyboard and screen readers work.
  • ItemMedia should be aria-hidden when the visual is decorative (e.g., a status dot).
  • ItemTitle acts as the accessible name — write it as a short label.

Best Practices

  • Use for list rows with mixed content. Media + content + actions fits in one Item.
  • Keep the media square. A 32px to 40px square reads as an avatar or icon.
  • Actions belong in ItemActions. Do not float buttons inside content.
  • One action cluster. More than three actions belong in a dropdown.