{
  "name": "side-nav",
  "type": "registry:ui",
  "framework": "react",
  "title": "Side Nav",
  "description": "A vertical list of grouped links for the sections of a settings screen.",
  "files": [
    {
      "path": "ui/side-nav.tsx",
      "content": "import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/*\n * The vertical list of sections down the side of a settings screen: a named\n * `<nav>` of groups. Pass `aria-label` to say what it navigates.\n */\nconst SideNav = React.forwardRef<HTMLElement, React.ComponentProps<\"nav\">>(\n  ({ className, ...props }, ref) => (\n    <nav\n      ref={ref}\n      className={cn(\"flex w-full flex-col\", className)}\n      {...props}\n    />\n  )\n)\nSideNav.displayName = \"SideNav\"\n\nexport interface SideNavGroupProps extends React.ComponentProps<\"div\"> {\n  /** The small heading over the group. Omit it for an unlabelled group. */\n  label?: string\n}\n\nconst SideNavGroup = React.forwardRef<HTMLDivElement, SideNavGroupProps>(\n  ({ className, label, children, ...props }, ref) => {\n    const id = React.useId()\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          \"border-newt-border py-2 [&:not(:first-child)]:border-t\",\n          className\n        )}\n        {...props}\n      >\n        {label === undefined ? null : (\n          <div\n            id={id}\n            className=\"px-2.5 py-1.5 text-xs font-bold uppercase tracking-[0.02em] text-newt-text-muted\"\n          >\n            {label}\n          </div>\n        )}\n        <ul\n          aria-labelledby={label === undefined ? undefined : id}\n          className=\"m-0 flex list-none flex-col gap-0.5 p-0\"\n        >\n          {children}\n        </ul>\n      </div>\n    )\n  }\n)\nSideNavGroup.displayName = \"SideNavGroup\"\n\nexport interface SideNavItemProps extends React.HTMLAttributes<HTMLElement> {\n  /** Makes the entry a link. Without it the entry is a button. */\n  href?: string\n  /** Marks the section being shown. */\n  current?: boolean\n  /** `danger` is for an entry that destroys something. */\n  variant?: \"default\" | \"danger\"\n  /** A count shown at the end of the entry. */\n  badge?: number\n  /** For a link: where it opens, and its relationship to the page. */\n  target?: string\n  rel?: string\n  /** For a button. */\n  disabled?: boolean\n}\n\n/*\n * One entry. `className` lands on the list item; every other attribute and\n * listener lands on the link or the button inside it, which is where a\n * `target`, a `disabled` or an `onClick` belongs.\n */\nconst SideNavItem = React.forwardRef<HTMLLIElement, SideNavItemProps>(\n  (\n    {\n      className,\n      href,\n      current = false,\n      variant = \"default\",\n      badge,\n      target,\n      rel,\n      disabled,\n      children,\n      ...props\n    },\n    ref\n  ) => {\n    const itemClassName = cn(\n      \"flex w-full cursor-pointer items-center justify-between gap-2 rounded-[var(--newt-radius-sm)] px-2.5 py-1.5 text-start font-[family-name:var(--newt-font-sans)] text-[15px] font-medium leading-5 no-underline transition-colors duration-fast ease-newt hover:bg-newt-bg-hover focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-newt-text-link disabled:cursor-not-allowed disabled:opacity-50 aria-[current=page]:bg-newt-bg-active\",\n      variant === \"danger\"\n        ? \"text-newt-danger\"\n        : \"text-newt-text-secondary hover:text-newt-text-primary aria-[current=page]:text-newt-text-primary\"\n    )\n    const content = (\n      <>\n        {children}\n        {badge === undefined ? null : (\n          <span className=\"min-w-4 rounded-full bg-newt-danger px-[5px] text-center text-[11px] font-bold leading-4 text-newt-on-accent\">\n            {badge}\n          </span>\n        )}\n      </>\n    )\n    return (\n      <li ref={ref} className={className}>\n        {href === undefined ? (\n          <button\n            type=\"button\"\n            disabled={disabled}\n            aria-current={current ? \"page\" : undefined}\n            className={itemClassName}\n            {...props}\n          >\n            {content}\n          </button>\n        ) : (\n          <a\n            href={href}\n            target={target}\n            rel={rel}\n            aria-current={current ? \"page\" : undefined}\n            className={itemClassName}\n            {...props}\n          >\n            {content}\n          </a>\n        )}\n      </li>\n    )\n  }\n)\nSideNavItem.displayName = \"SideNavItem\"\n\nexport { SideNav, SideNavGroup, SideNavItem }\n",
      "type": "registry:ui"
    }
  ]
}