Menu

A list of actions or options revealed on demand.

Installation

Install the component package, shared coss-svelte theme, and Bits UI peer.

npm install coss-svelte @coss-svelte/theme bits-ui

Usage

Import the Svelte component exports directly from the package.

import { Menu, MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSub, MenuSubPopup, MenuSubTrigger, MenuTrigger } from "coss-svelte";

Anatomy

  • Menu
  • MenuCheckboxItem
  • MenuGroup
  • MenuGroupLabel
  • MenuItem
  • MenuPopup
  • MenuRadioGroup
  • MenuRadioItem
  • MenuSeparator
  • MenuShortcut
  • MenuSub
  • MenuSubPopup
  • MenuSubTrigger
  • MenuTrigger

API Reference

Menu

A list of actions or options revealed on demand.

PropTypeDefaultDescription
bind:openbooleanfalseOpen state for the popup or disclosure. Bind with `bind:open`.
itemsMenuItem[][]Items rendered by the component's built-in fallback composition.
labelstring"Menu"Accessible label or fallback visible label for the control.
children : Snippet<[]>

Inherits from Bits UI DropdownMenu.Root.

MenuCheckboxItem

Renders one selectable or repeated item.

children : Snippet<[MenuCheckboxItemSnippetProps]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.CheckboxItem.

MenuGroup

Groups related items inside the parent component.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.Group.

MenuGroupLabel

Labels a group of related items.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.GroupHeading.

MenuItem

Renders one selectable or repeated item.

PropTypeDefaultDescription
variantstring"default"Visual variant for the component.
children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.Item.

MenuPopup

Renders the floating or modal surface for the parent component.

PropTypeDefaultDescription
portalProps{ disabled?: boolean; to?: PortalTarget }{}Configures the exact Bits Portal target (`to`) or renders inline when `disabled`.
children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.Content.

MenuRadioGroup

Groups related items inside the parent component.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.RadioGroup.

MenuRadioItem

Renders one selectable or repeated item.

children : Snippet<[MenuRadioItemSnippetProps]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.RadioItem.

MenuSeparator

Visually separates related content.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.Separator.

MenuShortcut

Displays a keyboard shortcut hint.

children : Snippet<[]>

Inherits from Svelte component attributes.

MenuSub

Groups nested sidebar menu content.

PropTypeDefaultDescription
bind:openbooleanfalseOpen state for the popup or disclosure. Bind with `bind:open`.
children : Snippet<[]>

Inherits from Bits UI DropdownMenu.Sub.

MenuSubPopup

Renders the floating or modal surface for the parent component.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.SubContent.

MenuSubTrigger

Renders the control that opens a submenu.

children : Snippet<[]>child : Snippet<[{ props: Record<string, unknown> }]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.SubTrigger.

MenuTrigger

Renders the control that opens, closes, or selects related content.

children : Snippet<[]>child : Snippet<[{ props: Record<string, unknown> }]>bind:ref : HTMLElement | null

Inherits from Bits UI DropdownMenu.Trigger.

Implementation Details

Status
Stable
Foundation
compound
Category
Overlays & Popups
Particles
9