Menu

Commands, links, checkboxes and submenus in a popover anchored to a trigger.

c2-menu

Attributes

NameTypeDefaultDescription
openbooleanfalseWhether the menu is showing. Set it to open or close the menu from code.
placementPlacementbottom-startPreferred placement of the surface (floating-ui names). Submenus default to `right-start`.
anchorstring | HTMLElement | undefinedundefinedAnchor element, or (attribute) the id of an element in the same tree. Defaults to the slotted trigger.
fit-anchorbooleanfalseMake the surface exactly as wide as the anchor instead of as wide as its content.
keep-openbooleanfalseKeep the menu open after a row is activated. Also available per row as `keep-open`.
disabledbooleanfalseIgnores the trigger and never opens.
aria-labelstring | nullnullAccessible name of the surface.

Events

NameTypeDescription
menu-selectCustomEvent<MenuSelectEventDetail>Bubbles from the activated row: `detail.value`, `detail.checked` and `detail.data` of that row.
toggleToggleEventFired after the menu opens or closes; `newState` is `open` or `closed`.

CSS custom properties

Grouped by the element and state they target. Click a group to collapse it; click a name to copy it.

NameTypeDefaultDescription
--c2-menu--backgroundcolor#ffffff
--c2-menu--min-widthpixel128pxFloor for the surface, which is otherwise as wide as its content (and never narrower than a slotted trigger).
--c2-menu--max-heightpixel320pxThe menu scrolls past this height.
--c2-menu--border-topborder1px solid #e4e4e7
--c2-menu--border-rightborder1px solid #e4e4e7
--c2-menu--border-bottomborder1px solid #e4e4e7
--c2-menu--border-leftborder1px solid #e4e4e7
--c2-menu--border-top-left-radiusborder-radius8px
--c2-menu--border-top-right-radiusborder-radius8px
--c2-menu--border-bottom-left-radiusborder-radius8px
--c2-menu--border-bottom-right-radiusborder-radius8px
--c2-menu--box-shadowbox-shadow0 8px 24px rgba(24, 24, 27, 0.08)
--c2-menu--padding-toppadding4px
--c2-menu--padding-rightpadding4px
--c2-menu--padding-bottompadding4px
--c2-menu--padding-leftpadding4px
--c2-menu--gappixelSpace between the rows.
--c2-menu__separator--colorcolor#e4e4e7
--c2-menu__separator--marginmargin4px 0
--c2-menu__heading--colorcolor#71717a
--c2-menu__heading--font-sizefont-size11px
--c2-menu__heading--font-weightfont-weight600
--c2-menu__heading--letter-spacingletter-spacing0.06em
--c2-menu__heading--text-transformtext-transformuppercase
--c2-menu__heading--padding-toppadding8px
--c2-menu__heading--padding-rightpadding8px
--c2-menu__heading--padding-bottompadding4px
--c2-menu__heading--padding-leftpadding8px

c2-menu-item

Attributes

NameTypeDefaultDescription
valuestringThe value reported in `menu-select`.
disabledbooleanfalseDims the row and ignores clicks and keyboard.
typeMenuItemTypeitem`item` is a command, `checkbox` toggles, `radio` picks one row of a `name` group.
checkedbooleanfalseChecked state of a `checkbox` / `radio` row; shown as a check mark or a dot.
namestring | undefinedRadio group name. Selecting a `radio` row unchecks the other rows of the same group in that menu.
hrefstring | undefinedMakes the row a link; Enter and a click navigate, and `menu-select` still fires.
targetstring | undefined
destructivebooleanfalsePaints the row in the destructive colour, for delete-style commands.
keep-openbooleanfalseKeeps the menu open after this row is activated, e.g. for a checkbox row.
labelstring | undefinedLabel used for typeahead and as the default slot's fallback content.
expandedbooleanfalseSet by the parent menu while this row's submenu is open. Announced as `aria-expanded`.
reserve-indicatorbooleanfalsePrivate: set by the parent menu on every row while any sibling is checkable, so the labels line up.

Events

NameTypeDescription
menu-selectCustomEvent<MenuSelectEventDetail>Fired after the row is activated by a click, Enter or Space. Cancelable; a row with a submenu never fires it.
checked-changeCustomEvent<{ checked: boolean; value: string }>Fired after the `checked` state of a `checkbox` / `radio` row changes.

CSS custom properties

Grouped by the element and state they target. Click a group to collapse it; click a name to copy it.

NameTypeDefaultDescription
--c2-menu-item--min-heightpixel32px
--c2-menu-item--gappixel8pxSpace between the indicator, icons, label and shortcut.
--c2-menu-item--border-top-left-radiusborder-radius6px
--c2-menu-item--border-top-right-radiusborder-radius6px
--c2-menu-item--border-bottom-left-radiusborder-radius6px
--c2-menu-item--border-bottom-right-radiusborder-radius6px
--c2-menu-item--padding-toppadding6px
--c2-menu-item--padding-rightpadding8px
--c2-menu-item--padding-bottompadding6px
--c2-menu-item--padding-leftpadding8px
--c2-menu-item--font-sizefont-size14px
--c2-menu-item--font-weightfont-weight
--c2-menu-item--font-stylefont-style
--c2-menu-item--font-familyfont-family
--c2-menu-item--line-heightpixel20px
--c2-menu-item--colorcolor#18181b
--c2-menu-item--backgroundcolortransparent
--c2-menu-item__hover--backgroundcolor#f4f4f5Also the highlight of the keyboard-focused row.
--c2-menu-item__hover--colorcolorDefaults to the row colour.
--c2-menu-item__description--colorcolor#71717a
--c2-menu-item__description--font-sizefont-size12px
--c2-menu-item__description--line-heightpixel16px
--c2-menu-item__description--margin-toppixel1px
--c2-menu-item__shortcut--colorcolor#a1a1aa
--c2-menu-item__shortcut--font-sizefont-size12px
--c2-menu-item__shortcut--letter-spacingletter-spacing0.04em
--c2-menu-item__icon--sizepixel16px
--c2-menu-item__icon--colorcolor#71717a
--c2-menu-item__indicator--sizepixel16px
--c2-menu-item__indicator--colorcolorThe check mark / radio dot. Defaults to the row colour.
--c2-menu-item__destructive--colorcolor#dc2626Label and icon colour of a `destructive` row.
--c2-menu-item__destructive__hover--backgroundcolor#fef2f2
--c2-menu-item__focus--outlineoutline2px solid rgba(2, 101, 220, 0.4)
--c2-menu-item__focus--outline-offsetpixel-2px
--c2-menu-item__disabled--opacityopacity0.38
escAccordionConnected, animated panels with shared borders and single or multiple expansion.LayoutAvatarImage, initials or icon for a person, with status dot and badge.Data displayBadgeTinted pill for status text, counts and dots, optionally pinned to a corner of another element.Data displayBreadcrumbNavigation trail of link buttons with separators, a current page and optional collapsing.NavigationButtonThemeable button with slots for text, prefix, suffix and running icons.ButtonsButton GroupAttached buttons with shared borders, optionally a segmented control with single or multiple selection.ButtonsCardGroups related content and actions on a single bordered surface.LayoutChat InputAuto-growing message box with a send button for chat interfaces.ChatChat MessageOne chat bubble with avatar, title, timestamp and message body.ChatCheckboxNative checkbox behaviour in a quiet, themeable box with an opt-in hover layer.InputsCode ViewerSyntax-highlighted code with line numbers, copy button and dark mode, powered by shiki.Data displayColor AreaTwo-dimensional area for picking saturation and value of a colour.InputsColor SelectColour swatch that opens a full picker built from area and slider.InputsColor SliderHorizontal slider for choosing a hue from 0 to 360.InputsCopy ButtonButton that copies text to the clipboard — the element it sits in, another element by id, or a literal string.ButtonsDetailsCollapsible disclosure built on native details and summary.LayoutIcon ButtonRound, hoverable button wrapping a slotted SVG icon.ButtonsKbdKeyboard key label for shortcuts and command hints, with the semantics of the native kbd element.Data displayLabelCaption that names and activates the control referenced by its for attribute, with a required marker.InputsLink ButtonText-styled control for link and navigation actions, rendered as a real anchor or a button.NavigationListVertical list container with single or multiple selection.Data displayList ItemSelectable row with icon slots, used on its own or as the option of list and select.Data displayMenuCommands, links, checkboxes and submenus in a popover anchored to a trigger.NavigationModalDialog built on the native dialog element: focus trap, backdrop, Escape, title, body and footer.FeedbackNavigation MenuSite navigation bar whose triggers open panels of links below the header.NavigationOverlayAnchored popup built on the browser Popover API, positioned with floating-ui.FeedbackPaginationPage navigation in three layouts: numbered pages, a simple page status, or a table-footer row with rows-per-page.NavigationProgressLinear progress bar, indeterminate or filling to a value, with an optional label and count.FeedbackRadioRadio options built on native inputs, grouped into one value with keyboard navigation.InputsSelectDropdown that pairs a themeable trigger with an anchored list of c2-list-item options.InputsSeperatorHorizontal or vertical rule with an optional label, for dividing content and toolbars.LayoutSheetDialog pinned to an edge of the screen, for content that complements the page rather than interrupting it.FeedbackSide NavResponsive navigation drawer beside the page: pushes the content on large screens, slides over it with a backdrop on small ones.NavigationSkeletonPlaceholder block standing in for content that has not arrived, in three shapes and three animations.FeedbackSliderRange input with a themeable track, thumb, step ticks and value bubble.InputsSpinnerCircular progress indicator, indeterminate or showing a value, with optional text.FeedbackSwitchOn/off toggle on a native switch input, with label, description and thumb icons.InputsTableVirtualized data grid with declarative columns, sorting, selection, pinning and resizing.Data displayTabsTab strip that shows one content panel at a time.NavigationText FieldSingle-line input with icon slots, clear button, helper and error text, and a character counter.InputsTextareaMultiline text input with resizing, helper and error text, and a character counter.InputsToastNotification cards and a manager for stacked, queued notifications with independent lifetimes.FeedbackTooltipContextual hint shown when its target is hovered or focused, rendered in the top layer.FeedbackFeather Icons287 open-source Feather icons, one web component each.IconsMat Icon2,234 Material Icons ligatures rendered through a single element.IconsPhosphor Icons1,512 flexible icons in six weights, one web component each.IconsThemingTheme every c2n component from a handful of design tokens with @c2n/theme, or reach for any component variable directly.GuideUsing c2n in an applicationThe workflow behind every c2n app: load the theme once, use c2-* tags directly, and turn every repeated pattern into a small variant or composed component.Guide