to.
Import
Usage
Auto-resolved from resource meta
The simplest way to useSidebarItem is to provide only the to prop. The title and icon will be automatically resolved from your resource definitions:
Override title and icon
You can override the auto-resolved title and icon:External links
External URLs are automatically detected and rendered with an external link icon:Custom rendering with render prop
For full control over the rendered UI, use therender prop:
Props
Target URL. External URLs (starting with
http:// or https://) are rendered as external links.Override title. When omitted, title is auto-resolved from resource meta.
Override icon. When omitted, icon is auto-resolved from resource meta.
Opens link in new tab with
target="_blank". When true, adds an external link icon and opens in new tab.How to match the current path for active state:
"exact": Only highlight when the path matches exactly"prefix": Highlight when the current path starts withto(with segment boundary check)
Custom rendering function. When specified, receives
title, icon, url, and isActive for full customization.Render Prop
When using therender prop, you receive SidebarItemRenderProps:
| Property | Type | Description |
|---|---|---|
title | string | Resolved title (from override or resource meta) |
url | string | Target URL |
icon | ReactNode | undefined | Resolved icon |
isActive | boolean | Whether this item is currently active |
Examples
Basic sidebar navigation
With custom badges
Mixed internal and external links
Related Components
- SidebarGroup - Collapsible group for organizing sidebar items
- SidebarLayout - Layout with sidebar and header