Skip to content

Menu Item

Menu items provide options for the user to pick from in a menu.

Option 1Option 2Option 3Disabled Prefix Icon favorite Suffix Icon face
html
<six-menu           style="
    max-width: 200px;
    border: solid 1px var(--six-panel-border-color);
    border-radius: var(--six-border-radius-medium);
  "
>
  <six-menu-item>Option 1</six-menu-item>
  <six-menu-item>Option 2</six-menu-item>
  <six-menu-item>Option 3</six-menu-item>
  <six-menu-divider></six-menu-divider>
  <six-menu-item disabled>Disabled</six-menu-item>
  <six-menu-divider></six-menu-divider>
  <six-menu-item>
    Prefix Icon
    <six-icon size="small" slot="prefix">favorite</six-icon>
  </six-menu-item>
  <six-menu-item>
    Suffix Icon
    <six-icon size="small" slot="suffix">face</six-icon>
  </six-menu-item>
</six-menu>

Properties

PropertyAttributeDescriptionTypeDefault
checkTypecheck-typeDefines if the checked state is displayed as a checkbox or a check-icon"check" | "checkbox"'check'
checkedcheckedInternal: Draws the item in a checked state. CheckType needs to be set to 'checkbox' or 'check' to show the checked statebooleanfalse
disableddisabledSet to true to draw the menu item in a disabled state.booleanfalse
valuevalueA unique value to store in the menu item. This can be used as a way to identify menu items when selected.string''

Methods

getTextLabel() => Promise<string>

Returns a text label based on the contents of the menu item's default slot.

Returns

Type: Promise<string>

removeFocus() => Promise<void>

Removes focus from the button.

Returns

Type: Promise<void>

setFocus(options?: FocusOptions) => Promise<void>

Sets focus on the button.

Parameters

NameTypeDescription
optionsFocusOptions | undefined

Returns

Type: Promise<void>

Slots

SlotDescription
The menu item's label.
"prefix"Used to prepend an icon or similar element to the menu item.
"suffix"Used to append an icon or similar element to the menu item.

Shadow Parts

PartDescription
"base"The component's base wrapper.
"checked-icon"The container that wraps the checked icon.
"label"The menu item label.
"prefix"The prefix container.
"suffix"The suffix container.

Dependencies

Used by

Depends on

Graph


Copyright © 2021-present SIX-Group