{
  "$schema": "https://design.senvenli.com/schema/component.full.json",
  "kind": "component",
  "family": "navigation",
  "status": "alpha",
  "import": "@senvenli/react/navigation",
  "name": "sidebar",
  "title": "Sidebar",
  "exports": [
    "Sidebar",
    "SidebarHeader",
    "SidebarItem",
    "SidebarSubmenu",
    "SidebarSection",
    "SidebarFooter"
  ],
  "description": "The main navigation of an app: brand, sections with nested items and badges, a pinned footer, collapsible to icons.",
  "keywords": [
    "app shell",
    "compound",
    "menu",
    "navigation",
    "side nav",
    "sidebar",
    "sidebar item",
    "sidebar section"
  ],
  "usage": {
    "when": [
      "Navigating an app with several sections."
    ],
    "instead": [
      {
        "use": "navbar",
        "when": "A public site with few pages."
      }
    ]
  },
  "a11y": {
    "keyboard": [
      {
        "keys": "Tab",
        "does": "Moves through the links."
      }
    ],
    "builtIn": [
      "The current page is marked with aria-current.",
      "Under 1024px it becomes a panel opened from the header.",
      "Collapsed, the rail shows the logo and the account's avatar alone; the brand name stays the link's accessible name."
    ],
    "youProvide": [
      "Section names.",
      "With children: a unique id on every SidebarItem and SidebarSubmenu (currentKey matches it), or isCurrent on the page's item."
    ]
  },
  "related": [
    "page-header",
    "navbar"
  ],
  "genui": {
    "expose": false
  },
  "source": [
    "src/navigation/sidebar.tsx"
  ],
  "props": {
    "Sidebar": [
      {
        "name": "brand",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "The product name, after `logo` (or the logo and name together). It links to `brandHref`. Or a `SidebarHeader` child."
      },
      {
        "name": "logo",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "The app's mark (an Icon or an image) before `brand`. Collapsed, the rail shows it alone, centred; the\nname stays the link's accessible name. Without it, collapsed shows the start of `brand`."
      },
      {
        "name": "brandHref",
        "type": "string",
        "required": false,
        "origin": "own",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "items",
        "type": "readonly SidebarItemData[]",
        "required": false,
        "origin": "own",
        "description": "The top-level items (links, or groups with `children`); five to eight is the comfortable range. With\n`sections`, these are the unlabelled items above the labelled sections (a dashboard) and may be empty. Ids\nare unique across `items` and `sections` (a repeated id marks two items as the current page).\nLeave it out to compose the navigation as children instead.",
        "schema": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "icon": {
                "type": "string",
                "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
              },
              "href": {
                "type": "string"
              },
              "children": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "icon": {
                      "type": "string",
                      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                    },
                    "href": {
                      "type": "string"
                    },
                    "children": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "icon": {
                            "type": "string",
                            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                          },
                          "href": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ]
                      }
                    }
                  },
                  "required": [
                    "id",
                    "label"
                  ]
                }
              }
            },
            "required": [
              "id",
              "label"
            ]
          }
        }
      },
      {
        "name": "children",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "With no `items`: the navigation composed from `SidebarItem`, `SidebarSubmenu` and `SidebarSection`\n(loose items first, then the sections), plus an optional `SidebarHeader` (instead of `brand`) and\n`SidebarFooter` (instead of `footer`)."
      },
      {
        "name": "sections",
        "type": "readonly SidebarSectionData[]",
        "required": false,
        "origin": "own",
        "description": "Labelled sections under `items`, in order. Each is a named group with an overline; collapsed,\nthe overline is visually hidden (the group keeps its name) and a separator stands in for it. Not\ncollapsible. Left out (or empty), the Sidebar renders exactly as before.",
        "schema": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "icon": {
                      "type": "string",
                      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                    },
                    "href": {
                      "type": "string"
                    },
                    "children": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "icon": {
                            "type": "string",
                            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                          },
                          "href": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "label"
                        ]
                      }
                    }
                  },
                  "required": [
                    "id",
                    "label"
                  ]
                }
              }
            },
            "required": [
              "id",
              "label",
              "items"
            ]
          }
        }
      },
      {
        "name": "currentKey",
        "type": "string",
        "required": false,
        "origin": "own",
        "description": "The id of the page's item: marked `aria-current=\"page\"`; its group stays open.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "footer",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "The account at the bottom: name and role after `avatar` (or Avatar, name and role together). Or a `SidebarFooter` child."
      },
      {
        "name": "avatar",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "The account's Avatar before `footer`. Collapsed, the rail shows it alone, centred, and `footer` is hidden.\nWithout it, collapsed shows the start of `footer`."
      },
      {
        "name": "isFooterPinned",
        "type": "boolean",
        "required": false,
        "origin": "own",
        "description": "Keeps the account (`footer`) and the collapse toggle in view at the bottom: the brand stays at\nthe top and only the navigation (`items`, then `sections`) scrolls between them, expanded and\ncollapsed. In the phone panel the account stays at the bottom the same way. The DOM order, and so the Tab\norder, is the same as without it. Off by default: the whole sidebar scrolls as one, as before.",
        "schema": {
          "type": "boolean"
        }
      },
      {
        "name": "isCollapsed",
        "type": "boolean",
        "required": false,
        "origin": "own",
        "description": "Icons only (56px), labels in tooltips. Controlled; or `defaultCollapsed` + `onCollapsedChange`.",
        "schema": {
          "type": "boolean"
        }
      },
      {
        "name": "defaultCollapsed",
        "type": "boolean",
        "required": false,
        "origin": "own",
        "schema": {
          "type": "boolean"
        }
      },
      {
        "name": "onCollapsedChange",
        "type": "(isCollapsed: boolean) => void",
        "required": false,
        "origin": "own"
      },
      {
        "name": "storageKey",
        "type": "string",
        "required": false,
        "origin": "own",
        "description": "Remembers the collapsed choice in localStorage under this key. Render `sidebarScript(storageKey,\n{ defaultCollapsed })` in <head> as well, with the same `defaultCollapsed`, so the first frame already\nhas the remembered width (no layout jump). Uncontrolled only: with `isCollapsed` the app owns the state.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "isMobileOpen",
        "type": "boolean",
        "required": false,
        "origin": "own",
        "description": "Under 1024px the sidebar is a menu panel from the start edge; the app's menu button opens it.",
        "schema": {
          "type": "boolean"
        }
      },
      {
        "name": "onMobileOpenChange",
        "type": "(isOpen: boolean) => void",
        "required": false,
        "origin": "own"
      },
      {
        "name": "aria-label",
        "type": "string",
        "required": false,
        "origin": "own",
        "description": "Names the navigation landmark; \"Main menu\" by default.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "motion",
        "type": "ComponentMotion",
        "required": false,
        "origin": "own",
        "description": "`auto` (follow the device), `reduce` or `none`, for this component; the provider's setting otherwise.",
        "schema": {
          "type": "string",
          "enum": [
            "none",
            "auto",
            "reduce"
          ]
        }
      }
    ],
    "SidebarHeader": [
      {
        "name": "children",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "The product name (or the logo and name together); it links to the Sidebar's `brandHref`."
      },
      {
        "name": "logo",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "The app's mark before the name; collapsed, the rail shows it alone. As the Sidebar's `logo`."
      }
    ],
    "SidebarItem": [
      {
        "name": "id",
        "type": "string",
        "required": true,
        "origin": "own",
        "description": "Unique in the sidebar; `currentKey` matches it.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "label",
        "type": "string",
        "required": true,
        "origin": "own",
        "description": "A noun for the page (\"Orders\"); also the tooltip when the sidebar is collapsed.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "icon",
        "type": "IconName",
        "required": false,
        "origin": "own",
        "description": "Lucide name; top-level items carry one (it is all a collapsed sidebar shows).",
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
        }
      },
      {
        "name": "href",
        "type": "string",
        "required": false,
        "origin": "own",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "badge",
        "type": "{ value: number; tone?: BadgeCountTone | undefined; }",
        "required": false,
        "origin": "own",
        "description": "A count (\"4 new\"): a Badge after the label, on the icon when collapsed."
      },
      {
        "name": "isCurrent",
        "type": "boolean",
        "required": false,
        "origin": "own",
        "description": "Marks this item as the page in view, instead of the Sidebar's `currentKey`.",
        "schema": {
          "type": "boolean"
        }
      }
    ],
    "SidebarSubmenu": [
      {
        "name": "id",
        "type": "string",
        "required": true,
        "origin": "own",
        "description": "Unique in the sidebar; `currentKey` matches it.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "badge",
        "type": "{ value: number; tone?: BadgeCountTone | undefined; }",
        "required": false,
        "origin": "own",
        "description": "A count (\"4 new\"): a Badge after the label, on the icon when collapsed."
      },
      {
        "name": "icon",
        "type": "IconName",
        "required": false,
        "origin": "own",
        "description": "Lucide name; top-level items carry one (it is all a collapsed sidebar shows).",
        "schema": {
          "type": "string",
          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
        }
      },
      {
        "name": "label",
        "type": "string",
        "required": true,
        "origin": "own",
        "description": "A noun for the page (\"Orders\"); also the tooltip when the sidebar is collapsed.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "children",
        "type": "React.ReactNode",
        "required": true,
        "origin": "own",
        "description": "The nested `SidebarItem`s, shown indented when it is open."
      }
    ],
    "SidebarSection": [
      {
        "name": "id",
        "type": "string",
        "required": false,
        "origin": "own",
        "description": "Also on the DOM as `data-section`.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "label",
        "type": "string",
        "required": true,
        "origin": "own",
        "description": "The overline over the items, already translated; it names the group, also when collapsed.",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "children",
        "type": "React.ReactNode",
        "required": true,
        "origin": "own",
        "description": "`SidebarItem`s and `SidebarSubmenu`s."
      }
    ],
    "SidebarFooter": [
      {
        "name": "children",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "The account's name and role (or Avatar, name and role together)."
      },
      {
        "name": "avatar",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "The account's Avatar before the rest; collapsed, the rail shows it alone. As the Sidebar's `avatar`."
      }
    ]
  },
  "tokens": [
    "ds-background-neutral-hovered",
    "ds-background-neutral-pressed",
    "ds-background-neutral-subtle-hovered",
    "ds-blanket",
    "ds-border",
    "ds-border-bold",
    "ds-border-focused",
    "ds-easing-enter",
    "ds-easing-exit",
    "ds-easing-standard",
    "ds-icon-brand",
    "ds-icon-subtle",
    "ds-radius-medium",
    "ds-shadow-overlay",
    "ds-space-050",
    "ds-space-100",
    "ds-space-150",
    "ds-space-200",
    "ds-space-400",
    "ds-surface-overlay",
    "ds-surface-sunken",
    "ds-text",
    "ds-text-subtle",
    "ds-text-subtlest"
  ],
  "strings": [
    "close",
    "collapseSidebar",
    "expandSidebar",
    "mainNavigation",
    "newTab"
  ],
  "quality": {
    "tests": true,
    "a11y": false,
    "docs": false,
    "visual": false,
    "dark": false,
    "rtl": false,
    "mcp": true,
    "generic": true
  }
}
