Skip to content

@vibe-labs/design-components-dropdowns

Dropdown menu component tokens, styles, and TypeScript types for the Vibe Design System.

Usage

css
@import "@vibe-labs/design-components-dropdowns";
ts
import { DropdownAlignments, DropdownItemVariants } from "@vibe-labs/design-components-dropdowns/types";
import type { DropdownMenuStyleProps, DropdownItemStyleProps } from "@vibe-labs/design-components-dropdowns/types";

Contents

Tokens (dropdown.css)

CSS custom properties defined in @layer vibe.tokens:

TokenDefaultDescription
--dropdown-bg--surface-elevatedMenu background
--dropdown-border-color--border-subtleMenu border
--dropdown-border-width--border-width-1Border width
--dropdown-radius--radius-lgBorder radius
--dropdown-shadow--shadow-lgBox shadow
--dropdown-padding--space-1Inner padding
--dropdown-min-width10remMinimum width
--dropdown-max-height20remMax height (scrollable)
--dropdown-z--z-dropdown (100)Z-index

Items

TokenDefaultDescription
--dropdown-item-height2remMinimum item height
--dropdown-item-px--space-2Horizontal padding
--dropdown-item-radius--radius-smItem border radius
--dropdown-item-font-size--text-smFont size
--dropdown-item-color--text-primaryText color
--dropdown-item-hover-bg--surface-hover-overlayHover background
--dropdown-item-active-bg--surface-active-overlayActive background
--dropdown-item-disabled-opacity--input-disabled-opacityDisabled state opacity

Groups

TokenDefaultDescription
--dropdown-group-label-font-size--text-xsGroup label size
--dropdown-group-label-color--text-mutedGroup label color
--dropdown-divider-color--border-subtleDivider color

Generated Styles (dropdown.g.css)

Component classes generated into @layer vibe.components.

Elements

  • dropdown — relative positioned inline-flex wrapper
  • dropdown-menu — absolutely positioned panel (hidden by default, flex column when open)
  • dropdown-item — full-width interactive row with hover/active/focus/disabled states
  • dropdown-item-icon — leading icon slot (1rem, muted)
  • dropdown-item-trail — trailing content (auto margin-left, muted, xs text)
  • dropdown-item-desc — description text below item (xs, muted, wraps)
  • dropdown-group — flex column container for grouped items
  • dropdown-group-label — uppercase section label
  • dropdown-divider — horizontal rule between sections
VariantPosition
bottom-startBelow, left-aligned
bottom-endBelow, right-aligned
bottom-centerBelow, centered
top-startAbove, left-aligned
top-endAbove, right-aligned

Item Variants

  • danger — red text with danger-subtle hover background

Selection States

Items with aria-selected="true" or aria-checked="true" get a hover overlay background and semibold weight.

Modifiers

  • open — shows menu with fade-in animation
  • full — menu matches trigger width

TypeScript Types (types/)

ts
DropdownAlignments  // ["bottom-start", "bottom-end", "bottom-center", "top-start", "top-end"]
DropdownItemVariants // ["danger"]

type DropdownAlignment
type DropdownItemVariant

interface DropdownStyleProps {}
interface DropdownMenuStyleProps { align?: DropdownAlignment; open?: boolean; full?: boolean }
interface DropdownItemStyleProps { variant?: DropdownItemVariant; disabled?: boolean }
interface DropdownItemIconStyleProps {}
interface DropdownItemTrailStyleProps {}
interface DropdownItemDescStyleProps {}
interface DropdownGroupStyleProps {}
interface DropdownGroupLabelStyleProps {}
interface DropdownDividerStyleProps {}

Dist Structure

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

Dependencies

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

Build

bash
npm run build