{
  "$schema": "https://rift-ds.com/schema/component.schema.json",
  "version": "1.40.0",
  "kind": "component",
  "name": "SideNav",
  "label": "Side nav",
  "slug": "side-nav",
  "category": "navigation",
  "description": "Vertical navigation links for drawers and long sidebars: sections, three indent levels, expand toggles, a compact size and its own scroll.",
  "client": true,
  "importPath": "rift-ds/components/SideNav/SideNav",
  "barrel": "main",
  "docsUrl": "https://rift-ds.com/components/side-nav",
  "markdownUrl": "https://rift-ds.com/components/side-nav.md",
  "exports": [
    {
      "component": "SideNav",
      "props": [
        {
          "name": "items",
          "type": "SideNavEntry[]",
          "typeKind": "array",
          "required": true,
          "description": "Navigation tree to render: rows, and at the top level, sections of rows.",
          "typeRefs": [
            "SideNavEntry"
          ]
        },
        {
          "name": "size",
          "type": "\"default\" | \"compact\"",
          "typeKind": "enum",
          "values": [
            "compact",
            "default"
          ],
          "required": false,
          "description": "Row density. `default` sets every row on the default control height; `compact` sets\nevery row on the 32px compact control height, for a long sidebar of\npages (a documentation site's hundred entries).",
          "default": "default"
        },
        {
          "name": "scrollable",
          "type": "boolean",
          "typeKind": "primitive",
          "required": false,
          "description": "Make the list its own scroll area: it fills the height its parent\ngives it, scrolls inside without carrying the page along at its ends,\nand brings the current row into view when it first renders. Put it in\na column with a fixed or sticky height.",
          "default": false
        },
        {
          "name": "currentHref",
          "type": "string",
          "typeKind": "primitive",
          "required": false,
          "description": "href of the current page — the exactly matching row gets `aria-current=\"page\"` and the active treatment."
        },
        {
          "name": "expandedIds",
          "type": "string[]",
          "typeKind": "array",
          "required": false,
          "description": "Controlled list of expanded item ids."
        },
        {
          "name": "defaultExpandedIds",
          "type": "string[]",
          "typeKind": "array",
          "required": false,
          "description": "Initially expanded item ids (uncontrolled). The branch and the\ncollapsible section that hold the current page start open as well, so a\nreader landing deep in a long tree sees where they are."
        },
        {
          "name": "onExpandedChange",
          "type": "((expandedIds: string[]) => void)",
          "typeKind": "function",
          "required": false,
          "description": "Fires with the full new list of expanded ids whenever a toggle is pressed, in both controlled and uncontrolled modes."
        },
        {
          "name": "multiple",
          "type": "boolean",
          "typeKind": "primitive",
          "required": false,
          "description": "Allow several branches expanded at once. Default false: expanding one collapses its siblings, never the section or the rows it sits in.",
          "default": false
        },
        {
          "name": "onNavigate",
          "type": "((item: SideNavItem, event: MouseEvent<HTMLElement, MouseEvent>) => void)",
          "typeKind": "function",
          "required": false,
          "description": "Fires when any link is clicked, alongside native navigation — e.g. to close the drawer that contains the list.",
          "typeRefs": [
            "SideNavItem"
          ]
        },
        {
          "name": "expandLabel",
          "type": "((label: string) => string)",
          "typeKind": "function",
          "required": false,
          "description": "Accessible name of a collapsed row's or section's toggle, given its label. Defaults to \"Expand <label>\".",
          "defaultExpression": "(label) => `Expand ${label}`"
        },
        {
          "name": "collapseLabel",
          "type": "((label: string) => string)",
          "typeKind": "function",
          "required": false,
          "description": "Accessible name of an expanded row's or section's toggle, given its label. Defaults to \"Collapse <label>\".",
          "defaultExpression": "(label) => `Collapse ${label}`"
        },
        {
          "name": "linkComponent",
          "type": "LinkComponent",
          "typeKind": "reference",
          "required": false,
          "description": "The component its links render with, such as Next.js's `Link`, so they\nnavigate through the app's router; passed on to each row's Button. Wins over a\nLinkProvider's; a plain `<a>` when neither is set.",
          "typeRefs": [
            "LinkComponent"
          ]
        },
        {
          "name": "className",
          "type": "string",
          "typeKind": "primitive",
          "required": false,
          "description": "Additional CSS classes",
          "default": ""
        }
      ]
    }
  ],
  "types": {
    "LinkComponent": {
      "kind": "type",
      "definition": "type LinkComponent = React.ElementType<LinkComponentProps>;",
      "description": "A component that renders a link in place of a plain `<a>`, such as a router's.",
      "refs": [
        "LinkComponentProps"
      ]
    },
    "LinkComponentProps": {
      "kind": "type",
      "definition": "type LinkComponentProps = React.ComponentPropsWithRef<'a'> & { href: string };",
      "description": "The props a link component receives: every anchor attribute, the ref, and\nan `href` that is always a string. Next.js's `Link` takes these as they\nare; a router whose link takes `to` instead needs a one-line adapter:\n`({ href, ...props }) => <RouterLink to={href} {...props} />`."
    },
    "SideNavEntry": {
      "kind": "type",
      "definition": "type SideNavEntry = SideNavItem | SideNavSection;",
      "description": "A top-level entry: a row, or a section of rows.",
      "refs": [
        "SideNavItem",
        "SideNavSection"
      ]
    },
    "SideNavItem": {
      "kind": "interface",
      "definition": "interface SideNavItem {\n  /** Row text. */\n  label: string;\n  /** Link destination — every row is a real link. */\n  href: string;\n  /** Stable identity for expansion state and aria wiring. Defaults to `href`. */\n  id?: string;\n  /** Child rows, indented one level. Nesting is supported three levels deep. */\n  items?: SideNavItem[];\n  /**\n   * When false, an item with children renders no toggle and its children stay\n   * visible — a permanent group rather than a collapsible section.\n   * @default true\n   */\n  collapsible?: boolean;\n  /**\n   * Forces the current-page treatment on this row regardless of the exact\n   * match against `currentHref` — for prefix-matched sections that should\n   * stay current on their child routes.\n   */\n  current?: boolean;\n  /** A short tag after the label, such as \"New\" or \"Beta\", drawn as a neutral Badge. */\n  badge?: string;\n  /** Icon before the label — Material Symbol name (string) or custom element (ReactNode) */\n  icon?: string | React.ReactNode;\n}"
    },
    "SideNavSection": {
      "kind": "interface",
      "definition": "interface SideNavSection {\n  /** Marks the entry as a section rather than a row. */\n  type: 'section';\n  /** The section's heading. */\n  label: string;\n  /** The section's rows. */\n  items: SideNavItem[];\n  /**\n   * Stable identity for its expansion state. Defaults to the label. In\n   * `expandedIds`, `defaultExpandedIds` and `onExpandedChange` a section\n   * appears as `section:<id>`, so its id never collides with a row's.\n   */\n  id?: string;\n  /**\n   * Let the reader fold the section under its heading. Unlike a row with\n   * `items`, which folds unless told not to, a section is a plain label\n   * unless told to fold.\n   * @default false\n   */\n  collapsible?: boolean;\n}",
      "description": "A titled section of rows: a heading over its items, the way a long\ndocumentation sidebar groups its pages. Sections sit only at the top\nlevel; their items nest like any others.",
      "refs": [
        "SideNavItem"
      ]
    }
  },
  "externalTypes": {
    "ComponentPropsWithRef": "react",
    "ElementType": "react",
    "HTMLElement": "typescript",
    "MouseEvent": "react",
    "ReactNode": "react"
  },
  "keyboard": [
    {
      "pattern": "disclosure",
      "part": "collapsible section",
      "label": "Disclosure",
      "apg": "https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/",
      "rows": [
        {
          "keys": [
            "Enter"
          ],
          "text": "Opens what it controls, and closes it when it is open."
        },
        {
          "keys": [
            "Space"
          ],
          "text": "Does the same as Enter."
        }
      ]
    }
  ],
  "size": {
    "gzip": 3233
  },
  "alternatives": [
    {
      "name": "DrillMenu",
      "when": "the menu fills a phone screen and each branch should open as a level of its own",
      "schemaUrl": "https://rift-ds.com/schema/components/drill-menu.json"
    }
  ]
}
