MenuItemLink

A sidebar navigation link. Optionally shows a keyboard shortcut hint and navigates on that shortcut.

Installation

pnpm dlx shadcn@latest add @chelone/menu-item-link

A sidebar navigation link. Optionally shows a keyboard shortcut hint and navigates on that shortcut.

Props

PropTypeDefaultDescription
classNamestring—Extra CSS class appended to the underlying `<SidebarMenuButton>`.
iconReactNode—Icon rendered before `label` (a lucide icon or any ReactNode).
keyboardShortcutstring—Keyboard shortcut string (e.g. `"mod+k"`, `"shift+/"`). When pressed anywhere, navigates to `to`. `mod` normalizes to `metaKey` on macOS, `ctrlKey` elsewhere.
keyboardShortcutRepresentationReactNode—Visual representation of the keyboard shortcut rendered after the label. Defaults to `<KeyboardShortcut keyboardShortcut={keyboardShortcut} />`.
labelReactNode—The text rendered alongside `icon`. Strings are auto-translated via `useTranslate` (with the string itself as the fallback). Pass a ReactNode to render custom content without a translation lookup.
onClick() => void—Click handler invoked after the default navigation. The default `<AppSidebar>` uses this to close the mobile drawer.
tostring—Target path for the link. Compared against the current location to derive the active state.
tooltipPropsOmit<TooltipProps, "children">—Extra props forwarded to the `<Tooltip>` wrapping the menu item.