Menu Item
<gstock-menu-item>
|
GstockMenuItem
API
Properties
| Name | Description | Reflects | Type | Default |
|---|---|---|---|---|
checked
|
Draws the item in a checked state. |
|
boolean
|
false
|
disabled
|
Draws the menu item in a disabled state, preventing selection. |
|
boolean
|
false
|
download
|
Tells the browser to download the linked file as this filename. Only used when href is present.
|
string | undefined
|
-
|
|
href
|
When set, the underlying button will be rendered as an <a> with this href instead of a <button>.
|
string
|
''
|
|
iconPrefix
prefix
|
The prefix icon name. |
string | undefined
|
-
|
|
iconSuffix
suffix
|
The suffix icon name. |
string | undefined
|
-
|
|
rel
|
When using href, this attribute will map to the underlying link’s rel attribute. Unlike regular links, the
default is noreferrer noopener to prevent security exploits. However, if you’re using target to point to a
specific tab/window, this will prevent that from working correctly. You can remove or change the default value by
setting the attribute to an empty string or a value of your choice, respectively.
|
string
|
'noreferrer noopener'
|
|
size
|
The size of the menu item. |
|
'small' | 'medium' | 'large'
|
'medium'
|
showCheckbox
show-checkbox
|
Leave a space at the beginning to accommodate the check icon of the menu item when the type is checkbox. |
|
boolean
|
-
|
target
|
Tells the browser where to open the link. Only used when href is present.
|
'_blank' | '_parent' | '_self' | '_top'
|
-
|
|
type
|
The type of menu item to render. To use checked, this value must be set to checkbox.
|
'normal' | 'checkbox'
|
'normal'
|
|
value
|
A unique value to store in the menu item. This can be used as a way to identify menu items when selected. |
string
|
''
|
|
updateComplete
|
A read-only promise that resolves when the component has finished updating. |
Learn more about attributes and properties .
Slots
| Name | Description |
|---|---|
default
|
The label of the menu item. |
help-text
|
The help text of the menu item. |
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. |
submenu
|
Used to denote a nested menu. |
Learn more about slots .
Methods
| Name | Description |
|---|---|
getTextLabel(
)
|
Returns a text label based on the contents of the menu item’s default slot. |
Learn more about methods .
Custom Properties
| Name | Description | Default |
|---|---|---|
--submenu-offset
|
The distance submenus shift to overlap the parent menu. | -2px |
Learn more about custom properties .
CSS Parts
| Name | Description |
|---|---|
base
|
The component’s base wrapper. |
checked-icon
|
The checked icon, which is only visible when the menu item is checked. |
prefix
|
The prefix container. |
label
|
The menu item label. |
suffix
|
The suffix container. |
submenu-icon
|
The submenu icon, visible only when the menu item has a submenu (not yet implemented). |
Learn more about CSS parts .
Dependencies
This component automatically imports the following dependencies.