{
  "schemaVersion": 1,
  "target": "react",
  "name": "item",
  "version": "0.1.1",
  "category": "layout",
  "title": "Item",
  "description": "A list row with media, a title, a description, and trailing actions, for settings and lists, with a group that separates rows with hairlines.",
  "tags": [
    "layout",
    "list",
    "row",
    "settings"
  ],
  "requires": {
    "projectTypes": [
      "next",
      "vite-react"
    ],
    "styling": "tailwind-v4"
  },
  "npmDependencies": {
    "@base-ui/react": "^1.9.0"
  },
  "registryDependencies": [
    {
      "name": "button",
      "version": "0.2.1"
    },
    {
      "name": "badge",
      "version": "0.2.1"
    }
  ],
  "docsPath": "/components/item",
  "props": [
    {
      "name": "variant",
      "type": "\"plain\" | \"outline\"",
      "default": "\"plain\"",
      "description": "plain has no frame (rows in an ItemGroup); outline draws its own hairline container."
    },
    {
      "name": "size",
      "type": "\"sm\" | \"md\"",
      "default": "\"md\"",
      "description": "Padding and gap."
    },
    {
      "name": "render",
      "type": "ReactElement",
      "description": "Makes the whole row a link or button, for example render={<a href=\"/usage\" />}; adds a hover tint and focus ring."
    },
    {
      "name": "ItemMedia variant",
      "type": "\"plain\" | \"icon\" | \"avatar\" | \"image\"",
      "default": "\"plain\"",
      "description": "An icon as is, an icon in a 32px hairline tile, a 40px round avatar, or a 48px thumbnail."
    },
    {
      "name": "ItemTitle / ItemDescription",
      "type": "ComponentProps<\"div\"> / ComponentProps<\"p\">",
      "description": "Name and supporting text. The description clamps to two lines."
    },
    {
      "name": "ItemActions",
      "type": "ComponentProps<\"div\">",
      "description": "Trailing buttons, switches, menus, or meta text. Never shrinks."
    },
    {
      "name": "ItemGroup framed",
      "type": "boolean",
      "default": "true",
      "description": "Draws the hairline container around the rows. Turn off inside a card."
    }
  ],
  "accessibility": [
    "ItemGroup renders role=\"list\" and each Item inside it role=\"listitem\"; name the group with aria-label or aria-labelledby.",
    "An Item rendered as a link keeps its link role and is wrapped in a listitem element, so the list stays valid.",
    "Interactive rows show an inset sky focus ring on keyboard focus; hover only tints the background.",
    "ItemMedia is decorative; put the meaning in the title or a Badge (the example states each connection's status in text).",
    "Hover tint transitions are removed with reduced motion."
  ],
  "states": [
    "default",
    "hover",
    "focus-visible"
  ],
  "files": [
    {
      "path": "ui/item.tsx",
      "content": "\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { type ComponentProps, createContext, useContext } from \"react\";\n\nfunction cx(...classes: (string | false | null | undefined)[]) {\n  return classes.filter(Boolean).join(\" \");\n}\n\nconst InGroupContext = createContext(false);\n\nconst variants = {\n  /** No frame; for rows inside a group, a card, or a panel. */\n  plain: \"\",\n  /** Its own hairline container, for a standalone row. */\n  outline: cx(\n    \"rounded-xl border border-zinc-950/10 bg-white shadow-[0_1px_2px_rgb(0_0_0/0.04)]\",\n    \"dark:border-white/10 dark:bg-black dark:shadow-[inset_0_1px_0_rgb(255_255_255/0.06)]\",\n  ),\n} as const;\n\nconst sizes = {\n  sm: \"gap-3 px-3 py-2.5\",\n  md: \"gap-3.5 px-4 py-3.5\",\n} as const;\n\nexport type ItemVariant = keyof typeof variants;\nexport type ItemSize = keyof typeof sizes;\n\nexport interface ItemProps extends useRender.ComponentProps<\"div\"> {\n  /** `plain` has no frame (rows in an `ItemGroup`); `outline` draws its own hairline container. */\n  variant?: ItemVariant;\n  /** Padding and gap. `sm` suits dense lists and menus, `md` suits settings rows. */\n  size?: ItemSize;\n}\n\n/**\n * A row with optional media, a title and description, and trailing actions. Renders a `<div>`;\n * pass `render={<a href=\"…\" />}` (or your router's link) to make the whole row a link, which adds\n * a hover tint and focus ring. Inside an `ItemGroup` it becomes a list item.\n */\nexport function Item({ variant = \"plain\", size = \"md\", render, className, ...props }: ItemProps) {\n  const inGroup = useContext(InGroupContext);\n  const element = useRender({\n    defaultTagName: \"div\",\n    render,\n    props: mergeProps<\"div\">(\n      {\n        role: inGroup && !render ? \"listitem\" : undefined,\n        className: cx(\n          \"group/item relative flex min-w-0 items-center text-left text-sm no-underline outline-none\",\n          \"text-zinc-950 dark:text-white\",\n          variants[variant],\n          sizes[size],\n          // Interactive rows (links, buttons) get a hover tint and an inset focus ring.\n          \"[&:is(a,button)]:transition-colors [&:is(a,button)]:duration-150 [&:is(a,button)]:ease-out motion-reduce:transition-none\",\n          \"[&:is(a,button)]:hover:bg-zinc-950/[0.03] dark:[&:is(a,button)]:hover:bg-white/[0.04]\",\n          \"focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-sky-500\",\n          className,\n        ),\n      },\n      props,\n    ),\n  });\n  // A link or button keeps its own role, so in a list it gets a listitem wrapper instead.\n  return inGroup && render ? <div role=\"listitem\">{element}</div> : element;\n}\n\nconst mediaVariants = {\n  /** The icon as is, in the tertiary text color. */\n  plain: \"text-zinc-500 [&_svg]:size-5\",\n  /** A 32px hairline tile around the icon. */\n  icon: cx(\n    \"size-8 rounded-lg border border-zinc-950/10 text-zinc-700 shadow-[0_1px_2px_rgb(0_0_0/0.04)] [&_svg]:size-4\",\n    \"dark:border-white/15 dark:text-zinc-300 dark:shadow-none\",\n  ),\n  /** A 40px round frame for an avatar image or initials. */\n  avatar: cx(\n    \"size-10 overflow-hidden rounded-full border border-zinc-950/10 text-xs font-medium text-zinc-600 dark:border-white/15 dark:text-zinc-300\",\n    \"[&>img]:size-full [&>img]:object-cover\",\n  ),\n  /** A 48px rounded frame for a thumbnail. */\n  image: \"size-12 overflow-hidden rounded-lg border border-zinc-950/10 dark:border-white/10 [&>img]:size-full [&>img]:object-cover\",\n} as const;\n\nexport type ItemMediaVariant = keyof typeof mediaVariants;\n\nexport interface ItemMediaProps extends ComponentProps<\"div\"> {\n  variant?: ItemMediaVariant;\n}\n\n/** Leading media: an icon, avatar, thumbnail, or status glyph. Decorative by default; label it if it carries meaning. */\nexport function ItemMedia({ variant = \"plain\", className, ...props }: ItemMediaProps) {\n  return (\n    <div\n      className={cx(\"flex shrink-0 items-center justify-center self-start [&_svg]:shrink-0\", mediaVariants[variant], className)}\n      {...props}\n    />\n  );\n}\n\n/** Holds the title and description; takes the remaining width and lets long text truncate or wrap. */\nexport function ItemContent({ className, ...props }: ComponentProps<\"div\">) {\n  return <div className={cx(\"flex min-w-0 flex-1 flex-col gap-0.5\", className)} {...props} />;\n}\n\n/** The row's name. A badge or count sits inline after the text and wraps below it when space runs out. */\nexport function ItemTitle({ className, ...props }: ComponentProps<\"div\">) {\n  return <div className={cx(\"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 leading-5 font-medium text-zinc-950 dark:text-white\", className)} {...props} />;\n}\n\n/** One or two lines of supporting text in the secondary color. Clamped to two lines. */\nexport function ItemDescription({ className, ...props }: ComponentProps<\"p\">) {\n  return <p className={cx(\"m-0 line-clamp-2 leading-5 text-zinc-600 dark:text-zinc-400\", className)} {...props} />;\n}\n\n/** Trailing controls: buttons, a switch, a menu, or meta text. Never shrinks. */\nexport function ItemActions({ className, ...props }: ComponentProps<\"div\">) {\n  return <div className={cx(\"flex shrink-0 items-center gap-2\", className)} {...props} />;\n}\n\nexport interface ItemGroupProps extends ComponentProps<\"div\"> {\n  /** Draws the hairline container around the rows. Turn off when the group already sits in a card. */\n  framed?: boolean;\n}\n\n/**\n * A list of items separated by hairline dividers. Announced as a list with its item count;\n * give it an `aria-label` or `aria-labelledby` naming what it lists.\n */\nexport function ItemGroup({ framed = true, className, ...props }: ItemGroupProps) {\n  return (\n    <InGroupContext.Provider value={true}>\n      <div\n        role=\"list\"\n        className={cx(\n          \"flex flex-col divide-y divide-zinc-950/[0.07] dark:divide-white/[0.08]\",\n          framed &&\n            \"overflow-hidden\",\n          framed &&\n            cx(\n              \"rounded-xl border border-zinc-950/10 bg-white shadow-[0_1px_2px_rgb(0_0_0/0.04)]\",\n              \"dark:border-white/10 dark:bg-black dark:shadow-[inset_0_1px_0_rgb(255_255_255/0.06)]\",\n            ),\n          className,\n        )}\n        {...props}\n      />\n    </InGroupContext.Provider>\n  );\n}\n"
    }
  ],
  "example": {
    "content": "import { Badge } from \"@/components/shaken/ui/badge\";\nimport { Button } from \"@/components/shaken/ui/button\";\nimport { Item, ItemActions, ItemContent, ItemDescription, ItemGroup, ItemMedia, ItemTitle } from \"@/components/shaken/ui/item\";\n\nconst icon = { \"aria-hidden\": true, viewBox: \"0 0 16 16\", fill: \"none\" } as const;\nconst stroke = { stroke: \"currentColor\", strokeWidth: 1.5, strokeLinecap: \"round\", strokeLinejoin: \"round\" } as const;\n\nexport default function ItemExample() {\n  return (\n    <div className=\"flex w-full max-w-lg flex-col gap-6\">\n      <section className=\"flex flex-col gap-2\">\n        <h3 id=\"integrations-heading\" className=\"m-0 text-xs font-medium text-zinc-500\">\n          Integrations\n        </h3>\n        <ItemGroup aria-labelledby=\"integrations-heading\">\n          <Item>\n            <ItemMedia variant=\"icon\">\n              <svg {...icon}>\n                <circle cx=\"4.5\" cy=\"3.75\" r=\"1.5\" {...stroke} />\n                <circle cx=\"4.5\" cy=\"12.25\" r=\"1.5\" {...stroke} />\n                <circle cx=\"11.5\" cy=\"5.75\" r=\"1.5\" {...stroke} />\n                <path d=\"M4.5 5.25v5.5M11.5 7.25c0 2.5-3 2.25-6.25 3.75\" {...stroke} />\n              </svg>\n            </ItemMedia>\n            <ItemContent>\n              <ItemTitle>\n                Git repositories\n                <Badge tone=\"success\">Connected</Badge>\n              </ItemTitle>\n              <ItemDescription>Agents can open branches and pull requests in 4 repositories.</ItemDescription>\n            </ItemContent>\n            <ItemActions>\n              <Button variant=\"ghost\" size=\"sm\">\n                Configure\n              </Button>\n            </ItemActions>\n          </Item>\n\n          <Item>\n            <ItemMedia variant=\"icon\">\n              <svg {...icon}>\n                <path d=\"M2.75 4.25c0-.83.67-1.5 1.5-1.5h7.5c.83 0 1.5.67 1.5 1.5v5c0 .83-.67 1.5-1.5 1.5H7l-3 2.5v-2.5h0a1.25 1.25 0 0 1-1.25-1.25z\" {...stroke} />\n              </svg>\n            </ItemMedia>\n            <ItemContent>\n              <ItemTitle>\n                Team chat\n                <Badge tone=\"warning\">Token expired</Badge>\n              </ItemTitle>\n              <ItemDescription>Approval requests are not being delivered. Reconnect to resume them.</ItemDescription>\n            </ItemContent>\n            <ItemActions>\n              <Button size=\"sm\">Reconnect</Button>\n            </ItemActions>\n          </Item>\n\n          <Item>\n            <ItemMedia variant=\"icon\">\n              <svg {...icon}>\n                <circle cx=\"8\" cy=\"8\" r=\"5.25\" {...stroke} />\n                <path d=\"M8 5.5V8l1.75 1.25\" {...stroke} />\n              </svg>\n            </ItemMedia>\n            <ItemContent>\n              <ItemTitle>\n                Issue tracker\n                <Badge tone=\"info\" dot pulse>\n                  Syncing\n                </Badge>\n              </ItemTitle>\n              <ItemDescription>Importing 1,284 issues so agents can link their work to tickets.</ItemDescription>\n            </ItemContent>\n            <ItemActions>\n              <span className=\"font-mono text-xs text-zinc-500 tabular-nums\">62%</span>\n            </ItemActions>\n          </Item>\n        </ItemGroup>\n      </section>\n\n      <Item variant=\"outline\" size=\"sm\" render={<a href=\"#usage\" />}>\n        <ItemMedia>\n          <svg {...icon}>\n            <path d=\"M2.75 13.25h10.5M4.5 10.5V8M8 10.5V4.5M11.5 10.5V6.5\" {...stroke} />\n          </svg>\n        </ItemMedia>\n        <ItemContent>\n          <ItemTitle>Usage this month</ItemTitle>\n          <ItemDescription>2.4M tokens across 318 agent runs</ItemDescription>\n        </ItemContent>\n        <ItemActions>\n          <svg {...icon} className=\"size-4 text-zinc-400 transition-[translate] duration-150 ease-out group-hover/item:translate-x-0.5 motion-reduce:transition-none dark:text-zinc-500\">\n            <path d=\"M6.25 4.25 10 8l-3.75 3.75\" {...stroke} />\n          </svg>\n        </ItemActions>\n      </Item>\n    </div>\n  );\n}\n"
  }
}
