Skip to content

@vibe-labs/design-components-menus

Navigation menu component tokens, styles, and TypeScript types for the Vibe Design System. For persistent, structural navigation (sidebars, top bars, multi-level). Distinct from dropdowns (triggered popups).

Usage

css
@import "@vibe-labs/design-components-menus";
ts
import { MenuFlyoutAlignments } from "@vibe-labs/design-components-menus/types";
import type { MenuStyleProps, MenuItemStyleProps, MenuFlyoutStyleProps } from "@vibe-labs/design-components-menus/types";

Contents

Tokens (menu.css)

CSS custom properties defined in @layer vibe.tokens:

Item

TokenDefaultDescription
--menu-item-height2.25remMinimum item height
--menu-item-px--space-3Horizontal padding
--menu-item-radius--radius-mdBorder radius
--menu-item-font-size--text-smFont size
--menu-item-font-weight400Default weight
--menu-item-color--text-secondaryText color
--menu-item-hover-bg--surface-hover-overlayHover background
--menu-item-active-bg--surface-active-overlayActive/current background
--menu-item-active-color--text-primaryActive text color
--menu-item-active-font-weight--font-semiboldActive weight
--menu-item-active-indicator--color-accentActive indicator bar color

Icons

TokenDefault
--menu-icon-size1.125rem
--menu-icon-color--text-muted
--menu-icon-active-color--color-accent

Groups & Dividers

TokenDefault
--menu-group-label-font-size--text-xs
--menu-group-label-color--text-muted
--menu-group-label-font-weight--font-semibold
--menu-divider-color--border-subtle

Nesting

TokenDefaultDescription
--menu-indent--space-4Nested menu left padding
--menu-nested-indicator-width1pxVertical tree line width
--menu-nested-indicator-color--border-subtleTree line color
TokenDefault
--menu-submenu-bg--surface-elevated
--menu-submenu-border-color--border-subtle
--menu-submenu-radius--radius-lg
--menu-submenu-shadow--shadow-lg
--menu-submenu-z--z-dropdown
--menu-collapse-speed--duration-normal

Generated Styles (menu.g.css)

Component classes generated into @layer vibe.components.

  • menu — vertical flex column, reset list styles
  • horizontal modifier — switches to row layout
  • Full-width interactive row with hover/focus/disabled states
  • aria-current sets active background, color, weight, and indicator bar
  • Vertical: left-side accent bar indicator (3px, 50% height)
  • Horizontal: bottom bar indicator (2px, 50% width)
  • Inset focus ring via box-shadow

Item Slots

  • menu-icon — leading icon (accent-colored when active)
  • menu-label — flex-grow text with ellipsis overflow
  • menu-trail — trailing badge/count text
  • menu-chevron — rotates 90° when aria-expanded="true"

Groups & Dividers

  • menu-group — flex column wrapper
  • menu-group-label — uppercase section header
  • menu-divider — horizontal separator

Nested Menus

  • Indented with vertical tree-line indicator via ::before
  • menu-collapse — smooth grid-template-rows expand/collapse animation
  • expanded modifier — opens the collapsed section

Flyout Submenus

  • Absolutely positioned popup with fade-in animation
  • Alignment: right (default, to the right) · bottom (below)
  • open modifier — shows the flyout

Compact Mode

  • Hides labels, trails, chevrons, and group labels
  • Centers items for icon-only sidebar navigation
  • Hides nested tree-line indicators

TypeScript Types (types/)

ts
MenuFlyoutAlignments // ["right", "bottom"]
type MenuFlyoutAlignment

interface MenuStyleProps { horizontal?: boolean; compact?: boolean }
interface MenuItemStyleProps { disabled?: boolean }
interface MenuIconStyleProps {}
interface MenuLabelStyleProps {}
interface MenuTrailStyleProps {}
interface MenuChevronStyleProps {}
interface MenuGroupStyleProps {}
interface MenuGroupLabelStyleProps {}
interface MenuDividerStyleProps {}
interface MenuCollapseStyleProps { expanded?: boolean }
interface MenuFlyoutStyleProps { align?: MenuFlyoutAlignment; open?: boolean }

Dist Structure

FileDescription
index.cssBarrel — imports tokens + generated styles
menu.cssToken definitions
menu.g.cssGenerated component styles
index.js / index.d.tsTypeScript types + runtime constants

Dependencies

Requires tokens from @vibe-labs/design (surfaces, borders, spacing, typography, colors, transitions, elevation, z-index).

Build

bash
npm run build