The ld-menuitem
component is a subcomponent for ld-context-menu
/ ld-menu
and is meant to be used in the slot of either the ld-context-menu
, the ld-menu
or the ld-menuitem-group
component.
<ld-menu>
<ld-menuitem>Menu item</ld-menuitem>
</ld-menu>
<ul class="ld-menu" role="menu">
<li class="ld-menuitem" role="menuitemradio">
<button class="ld-menuitem__button ld-button ld-button--justify-start ld-button--ghost ld-button--neutral-ghost">
Menu item
</button>
</li>
</ul>
<LdMenu>
<LdMenuitem>Menu item</LdMenuitem>
</LdMenu>
<ld-menu>
<ld-menuitem mode="highlight">Menu item</ld-menuitem>
</ld-menu>
<ul class="ld-menu" role="menu">
<li class="ld-menuitem" role="menuitemradio">
<button class="ld-menuitem__button ld-button ld-button--justify-start ld-button--ghost">
Menu item
</button>
</li>
</ul>
<LdMenu>
<LdMenuitem mode="highlight">Menu item</LdMenuitem>
</LdMenu>
<ld-menu>
<ld-menuitem mode="danger">Menu item</ld-menuitem>
</ld-menu>
<ul class="ld-menu" role="menu">
<li class="ld-menuitem" role="menuitemradio">
<button class="ld-menuitem__button ld-button ld-button--justify-start ld-button--ghost ld-button--danger-ghost">
Menu item
</button>
</li>
</ul>
<LdMenu>
<LdMenuitem mode="danger">Menu item</LdMenuitem>
</LdMenu>
<ld-menu>
<ld-menuitem href="#" target="_blank">Menu item</ld-menuitem>
</ld-menu>
<ul class="ld-menu" role="menu">
<li class="ld-menuitem" role="menuitemradio">
<a class="ld-menuitem__button ld-button ld-button--justify-start ld-button--ghost ld-button--neutral-ghost" href="#" target="_blank" rel="noreferrer noopener">
Menu item
</a>
</li>
</ul>
<LdMenu>
<LdMenuitem href="#" target="_blank">Menu item</LdMenuitem>
</LdMenu>
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
disabled |
disabled |
Disabled state of the menu item. | boolean |
undefined |
href |
href |
Transforms the menu item to an anchor element. See mdn docs for more information on the href attribute. |
HTMLLdButtonElement |
undefined |
key |
key |
for tracking the node's identity when working with lists | string | number |
undefined |
ldTabindex |
ld-tabindex |
Tab index of the menu item. | number |
undefined |
mode |
mode |
Display mode. | "danger" | "highlight" | "neutral" |
'neutral' |
preventClose |
prevent-close |
Prevent closing of the context menu on click. | boolean |
undefined |
ref |
ref |
reference to component | any |
undefined |
target |
target |
The target attributed can be used in conjunction with the href attribute. See mdn docs for more information on the target attribute. |
HTMLLdButtonElement |
undefined |
focusInner() => Promise<void>
#Sets focus on the anchor or button
Type: Promise<void>
Part | Description |
---|---|
"button" |
ld-button element wrapping the default slot |
"listitem" |
li element wrapping the ld-button element |
graph TD;
ld-menuitem --> ld-button
style ld-menuitem fill:#f9f,stroke:#333,stroke-width:4px
Built with StencilJS