{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "list",
  "type": "registry:ui",
  "title": "List",
  "description": "A list whose markers carry the voice of the page: numbered claims, a row of checks, a \"what we're not saying\" list of crosses. The marker sits on the first line of each item, whatever the item holds: a sentence, rich text with inline `Citation` chips, a…",
  "author": "ofri-peretz <https://github.com/ofri-peretz>",
  "categories": [
    "foundation",
    "primitive"
  ],
  "dependencies": [],
  "registryDependencies": [
    "https://ds.interlace.tools/r/interlace-base.json",
    "https://ds.interlace.tools/r/cn.json"
  ],
  "files": [
    {
      "path": "registry/interlace-ui/list.tsx",
      "target": "components/ui/list.tsx",
      "type": "registry:ui",
      "content": "import * as React from 'react';\n\n// @interlace/list v1.0.0 — Interlace design system.\n// Docs, props and live preview: https://ds.interlace.tools/c/list\n// What changed since: https://ds.interlace.tools/c/list#history\n// Generated banner — keep it, the upgrade diff reads this version.\n\n/**\n * @interlace/ui — List\n *\n * A list whose markers carry the voice of the page: numbered claims, a row of\n * checks, a \"what we're not saying\" list of crosses. The marker sits on the\n * first line of each item, whatever the item holds: a sentence, rich text\n * with inline `Citation` chips, a paragraph and a link.\n *\n * | `marker`  | Renders | Marker                                     | Use it for                         |\n * | --------- | ------- | ------------------------------------------ | ---------------------------------- |\n * | `bullet`  | `ul`    | A small dot                                | Plain lists                        |\n * | `number`  | `ol`    | The item's number in a filled circle       | Claims or steps read in order      |\n * | `check`   | `ul`    | A check in the success colour              | What is true, done, or included    |\n * | `cross`   | `ul`    | A cross in the destructive colour          | What is not claimed, not included  |\n *\n * ## The meaning is in the words\n *\n * Every marker is drawn in CSS (`::before`), so assistive technology never\n * reads it. A list of crosses needs a heading that says what the crosses\n * mean (\"What we're not saying\"), exactly as a sighted reader needs it.\n * Numbers come from the browser's own `list-item` counter, so `start` and\n * `reversed` on the `ol` work as they do on any ordered list, and screen\n * readers still announce the list and its length.\n *\n * ## Anatomy\n *\n *   List                     (ul | ol — data-slot=\"list\", data-marker)\n *     └─ ListItem × n        (li)\n *         ├─ list-marker     (span, aria-hidden — one line tall; the marker is its ::before)\n *         └─ {children}\n *\n * ## MIN_VIEWPORT — 320\n *\n * Text rows with a fixed 2rem gutter for the marker; content wraps.\n *\n * | Rule | Concept                 | Where in this file                                         |\n * | ---- | ----------------------- | ---------------------------------------------------------- |\n * | R4   | Extends native el       | `ul` / `ol` / `li` props                                   |\n * | R6   | data-slot per part      | list / list-item, `data-marker` on the root                |\n * | R7   | cn + ...rest            | `cn(…, className)` + `{...props}`                          |\n * | R8   | Enums, not booleans     | `marker`, `density`                                        |\n * | R14  | Declares min viewport   | `data-min-viewport` on the root + exported const           |\n * | R19  | Tokens only             | `bg-foreground`, `bg-success`, `bg-destructive`            |\n * | R25  | Server component        | No hooks; the item reads the marker from the root in CSS   |\n * | R26  | A11y from native el     | A real `ul`/`ol`; markers are decoration, words carry meaning |\n */\n\nimport { cn } from '@/lib/utils';\n\nexport const MIN_VIEWPORT = 320 as const;\n\nexport type ListMarker = 'bullet' | 'number' | 'check' | 'cross';\n\n/**\n * Each marker is the ::before of a one-line box, keyed off the root's\n * `data-marker` so ListItem needs no prop and no context.\n */\nconst MARKER = {\n  bullet:\n    'group-data-[marker=bullet]/list:before:size-1.5 group-data-[marker=bullet]/list:before:rounded-full group-data-[marker=bullet]/list:before:bg-foreground',\n  number:\n    'group-data-[marker=number]/list:before:grid group-data-[marker=number]/list:before:size-6 group-data-[marker=number]/list:before:place-items-center group-data-[marker=number]/list:before:rounded-full group-data-[marker=number]/list:before:bg-foreground group-data-[marker=number]/list:before:text-xs group-data-[marker=number]/list:before:leading-none group-data-[marker=number]/list:before:font-semibold group-data-[marker=number]/list:before:text-background group-data-[marker=number]/list:before:tabular-nums group-data-[marker=number]/list:before:content-[counter(list-item)]',\n  check:\n    'group-data-[marker=check]/list:before:size-4 group-data-[marker=check]/list:before:bg-success group-data-[marker=check]/list:before:[mask-repeat:no-repeat] group-data-[marker=check]/list:before:[mask-size:contain] group-data-[marker=check]/list:before:[mask-image:url(data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2024%2024%27%20fill=%27none%27%20stroke=%27black%27%20stroke-width=%273%27%20stroke-linecap=%27round%27%20stroke-linejoin=%27round%27%3E%3Cpath%20d=%27M20%206%209%2017l-5-5%27/%3E%3C/svg%3E)]',\n  cross:\n    'group-data-[marker=cross]/list:before:size-4 group-data-[marker=cross]/list:before:bg-destructive group-data-[marker=cross]/list:before:[mask-repeat:no-repeat] group-data-[marker=cross]/list:before:[mask-size:contain] group-data-[marker=cross]/list:before:[mask-image:url(data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2024%2024%27%20fill=%27none%27%20stroke=%27black%27%20stroke-width=%273%27%20stroke-linecap=%27round%27%20stroke-linejoin=%27round%27%3E%3Cpath%20d=%27M18%206%206%2018M6%206l12%2012%27/%3E%3C/svg%3E)]',\n} as const satisfies Record<ListMarker, string>;\n\nconst DENSITY = {\n  compact: 'space-y-1.5',\n  default: 'space-y-3',\n  relaxed: 'space-y-5',\n} as const;\n\ntype ListOwnProps = {\n  /** The marker every item gets. `number` renders an `ol`. @default 'bullet' */\n  marker?: ListMarker;\n  /** Space between items. @default 'default' */\n  density?: keyof typeof DENSITY;\n};\n\n/**\n * `marker=\"number\"` renders an `ol` and takes its props (`start`,\n * `reversed`); every other marker renders a `ul`, so those are a type error.\n */\nexport type ListProps =\n  | (ListOwnProps & { marker: 'number' } & React.ComponentProps<'ol'>)\n  | (ListOwnProps & { marker?: Exclude<ListMarker, 'number'> } & React.ComponentProps<'ul'>);\n\nfunction List({ marker = 'bullet', density = 'default', className, ...props }: ListProps) {\n  const shared = {\n    'data-slot': 'list',\n    'data-marker': marker,\n    'data-min-viewport': String(MIN_VIEWPORT),\n    className: cn('group/list list-none ps-0', DENSITY[density], className),\n  };\n  return marker === 'number' ? (\n    <ol {...(props as React.ComponentProps<'ol'>)} {...shared} />\n  ) : (\n    <ul {...(props as React.ComponentProps<'ul'>)} {...shared} />\n  );\n}\n\nexport type ListItemProps = React.ComponentProps<'li'>;\n\nfunction ListItem({ className, children, ...props }: ListItemProps) {\n  return (\n    <li data-slot=\"list-item\" className={cn('relative ps-8', className)} {...props}>\n      {/* The marker box is one line tall in the item's own font (1lh), so the\n          marker centres on the first line at any text size. Hidden: the words\n          carry the meaning, and its only content is a ::before. */}\n      <span\n        aria-hidden\n        data-slot=\"list-marker\"\n        className={cn(\n          \"absolute start-0 top-0 flex h-[1lh] w-6 items-center justify-center before:content-['']\",\n          MARKER.bullet,\n          MARKER.number,\n          MARKER.check,\n          MARKER.cross,\n        )}\n      />\n      {children}\n    </li>\n  );\n}\n\nconst ListWithItem = Object.assign(List, { Item: ListItem });\n\nexport { ListWithItem as List, ListItem };\n"
    }
  ],
  "meta": {
    "tier": "primitive",
    "client": false,
    "minViewport": 320,
    "loading": false,
    "version": "1.0.0",
    "since": "2.0.0"
  },
  "docs": "## @interlace/list\n\nInstalled to `components/ui/list.tsx`.\n\n```tsx\nimport { /* … */ } from '@/components/ui/list';\n```\n\nProps, a11y contract, live preview and source: https://ds.interlace.tools/c/list\n\nRequires the `@interlace/interlace-base` CSS baseline (installed automatically as a registry dependency). For the Interlace look, also add `@interlace/theme`."
}
