{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "timeline",
  "type": "registry:ui",
  "title": "Timeline",
  "description": "An ordered list of numbered rows joined by a line: each with an optional time, a title and content, and a state (done, current, upcoming).",
  "categories": [
    "ui"
  ],
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "@rivier-ui/theme",
    "@rivier-ui/cn"
  ],
  "files": [
    {
      "path": "registry/ui/timeline.tsx",
      "type": "registry:ui",
      "target": "components/ui/timeline.tsx",
      "content": "/**\n * @name timeline\n * @category ui\n * @description An ordered list of numbered rows joined by a line: each with an optional time, a title and content, and a state (done, current, upcoming).\n * @when Things that happen in an order: the parts of a day, the stages of an order or a delivery, a history of changes, the steps of a plan. The number and the state are read out with each row. For the steps of a form the person is filling in use steps; for rows people reorder use sortable-list; for unordered items use a plain list.\n * @example\n * <Timeline aria-label=\"Saturday\">\n *   <TimelineItem state=\"done\">\n *     <TimelineTime dateTime=\"2026-03-14T09:30\">09:30</TimelineTime>\n *     <TimelineTitle>Market walk</TimelineTitle>\n *     <TimelineContent>Meet at the north gate.</TimelineContent>\n *   </TimelineItem>\n *   <TimelineItem state=\"current\">\n *     <TimelineTime dateTime=\"2026-03-14T12:30\">12:30</TimelineTime>\n *     <TimelineTitle>Lunch</TimelineTitle>\n *   </TimelineItem>\n *   <TimelineItem>\n *     <TimelineTitle>Free afternoon</TimelineTitle>\n *   </TimelineItem>\n * </Timeline>\n */\nimport { Check } from \"lucide-react\";\nimport { createContext, use, type ComponentProps } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\nexport type TimelineState = \"done\" | \"current\" | \"upcoming\";\n\nconst DEFAULT_LABELS: Record<TimelineState, string> = { done: \"Done\", current: \"Now\", upcoming: \"Upcoming\" };\n\nconst TimelineContext = createContext<Record<TimelineState, string>>(DEFAULT_LABELS);\n\nexport type TimelineProps = ComponentProps<\"ol\"> & {\n  /** The words for the three states, read out with each row and shown beside the current one. Translate them with the interface. */\n  stateLabels?: Partial<Record<TimelineState, string>>;\n};\n\n/** An ordered list. The numbers in the markers are drawn from the list's own counter, so they follow the rows. */\nexport function Timeline({ className, stateLabels, ...props }: TimelineProps) {\n  return (\n    <TimelineContext value={{ ...DEFAULT_LABELS, ...stateLabels }}>\n      <ol data-slot=\"timeline\" className={cn(\"flex w-full min-w-0 flex-col [counter-reset:rui-timeline]\", className)} {...props} />\n    </TimelineContext>\n  );\n}\n\nexport type TimelineItemProps = ComponentProps<\"li\"> & {\n  /** \"done\" (a tick), \"current\" (a filled marker and the word), or \"upcoming\" (default: an outlined number). */\n  state?: TimelineState;\n};\n\n/**\n * One row. The marker sits at the inline start with a hairline running down to the next row. The state is a\n * shape (tick, filled, outlined) and a word (visible for the current row, read out for all), never colour\n * alone; the current row carries `aria-current=\"step\"`.\n */\nexport function TimelineItem({ className, state = \"upcoming\", children, ...props }: TimelineItemProps) {\n  const labels = use(TimelineContext);\n  return (\n    <li\n      data-slot=\"timeline-item\"\n      data-state={state}\n      aria-current={state === \"current\" ? \"step\" : undefined}\n      className={cn(\n        \"group/timeline relative flex min-w-0 gap-3 pb-6 [counter-increment:rui-timeline] before:absolute before:start-[calc(0.875rem-0.5px)] before:top-8 before:bottom-1 before:w-px before:bg-border-strong last:pb-0 last:before:hidden\",\n        className,\n      )}\n      {...props}\n    >\n      <span\n        data-slot=\"timeline-marker\"\n        className={cn(\n          \"relative z-[1] inline-flex size-7 shrink-0 items-center justify-center rounded-full border text-xs font-medium tabular-nums\",\n          state === \"upcoming\" && \"border-border-strong bg-background text-foreground before:content-[counter(rui-timeline)]\",\n          state === \"current\" && \"border-primary bg-primary text-primary-foreground before:content-[counter(rui-timeline)]\",\n          state === \"done\" && \"border-primary bg-highlight-soft text-foreground\",\n        )}\n      >\n        {state === \"done\" ? <Check aria-hidden=\"true\" strokeWidth={2} className=\"size-3.5\" /> : null}\n        <span className=\"sr-only\">{labels[state]}: </span>\n      </span>\n      <div className=\"flex min-w-0 flex-1 flex-col gap-0.5 pt-0.5\">\n        {state === \"current\" ? (\n          <span aria-hidden=\"true\" data-slot=\"timeline-state\" className=\"text-xs font-medium text-foreground\">\n            {labels.current}\n          </span>\n        ) : null}\n        {children}\n      </div>\n    </li>\n  );\n}\n\n/** When it happens. Pass `dateTime` in machine form and the words the person reads as children. */\nexport function TimelineTime({ className, ...props }: ComponentProps<\"time\">) {\n  return <time data-slot=\"timeline-time\" className={cn(\"text-xs text-muted-foreground tabular-nums\", className)} {...props} />;\n}\n\n/** The row's name. Render a heading with a class of your own when the rows are sections of a page. */\nexport function TimelineTitle({ className, ...props }: ComponentProps<\"p\">) {\n  return <p data-slot=\"timeline-title\" className={cn(\"text-sm font-medium break-words text-foreground\", className)} {...props} />;\n}\n\n/** Anything else about the row: a sentence, a picture, a card, actions. */\nexport function TimelineContent({ className, ...props }: ComponentProps<\"div\">) {\n  return <div data-slot=\"timeline-content\" className={cn(\"mt-1 min-w-0 text-sm text-muted-foreground\", className)} {...props} />;\n}\n"
    }
  ],
  "meta": {
    "category": "ui",
    "when": "Things that happen in an order: the parts of a day, the stages of an order or a delivery, a history of changes, the steps of a plan. The number and the state are read out with each row. For the steps of a form the person is filling in use steps; for rows people reorder use sortable-list; for unordered items use a plain list.",
    "example": "<Timeline aria-label=\"Saturday\">\n  <TimelineItem state=\"done\">\n    <TimelineTime dateTime=\"2026-03-14T09:30\">09:30</TimelineTime>\n    <TimelineTitle>Market walk</TimelineTitle>\n    <TimelineContent>Meet at the north gate.</TimelineContent>\n  </TimelineItem>\n  <TimelineItem state=\"current\">\n    <TimelineTime dateTime=\"2026-03-14T12:30\">12:30</TimelineTime>\n    <TimelineTitle>Lunch</TimelineTitle>\n  </TimelineItem>\n  <TimelineItem>\n    <TimelineTitle>Free afternoon</TimelineTitle>\n  </TimelineItem>\n</Timeline>",
    "client": false
  }
}
