Liking cljdoc? Tell your friends :D

x-menu-item

A single item inside an x-menu. Fires x-menu-item-select when activated; x-menu consumes this event and re-dispatches x-menu-select.

Tag name

x-menu-item

Attributes

AttributeTypeDefaultNotes
valuestring""Value emitted in the select event detail
disabledbooleanabsentPrevents interaction and keyboard focus
variantstring"""" (default) or "danger" (red colour)
typestring"""" (item) or "divider" (renders a separator)

Properties

PropertyTypeReflects attribute
valuestringyes
disabledbooleanyes
variantstringyes
typestringyes

Events

EventBubblesComposedDetailNotes
x-menu-item-selectyesyes{ value }Consumed by x-menu

Slots

SlotNotes
defaultItem label text / content
iconLeading icon (SVG, img, span …)

When elements are assigned to the icon slot, the has-icon attribute is set on the host; this drives icon span visibility via CSS.

CSS custom properties

PropertyLight defaultDark default
--x-menu-item-color#111827#f9fafb
--x-menu-item-hover-bg#f3f4f6#1f2937
--x-menu-item-focus-bg#eff6ff#1e3a5f
--x-menu-item-focus-color#1d4ed8#60a5fa
--x-menu-item-disabled-opacity0.450.45
--x-menu-item-danger-color#dc2626#f87171
--x-menu-item-danger-hover-bg#fef2f2#2d1515
--x-menu-item-padding8px 12px8px 12px
--x-menu-item-border-radius4px4px
--x-menu-item-font-size0.9375rem0.9375rem
--x-menu-item-icon-gap8px8px
--x-menu-item-divider-color#e5e7eb#374151

Divider rendering

When type="divider", the item renders an <hr> element styled as a horizontal rule. The host receives role="separator" and no tabindex. Clicks are ignored.

Keyboard behaviour

KeyResult
EnterDispatch x-menu-item-select
SpaceDispatch x-menu-item-select
ArrowUp / ArrowDownBubble to x-menu for navigation

Accessibility

  • role="menuitem" on the host element (or role="separator" for dividers).
  • tabindex="-1" on non-divider items; focus is managed by x-menu.
  • aria-disabled="true" on disabled items.

Usage

<!-- Used inside x-menu -->
<x-menu label="Options">
  <button slot="trigger">Options</button>

  <x-menu-item value="copy">
    <span slot="icon">📋</span>
    Copy
  </x-menu-item>

  <x-menu-item value="cut">Cut</x-menu-item>

  <x-menu-item type="divider"></x-menu-item>

  <x-menu-item value="delete" variant="danger">Delete</x-menu-item>
  <x-menu-item value="noop" disabled>Unavailable</x-menu-item>
</x-menu>

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close