Menu item
One row in a menu, or one option in a select: a label with an optional icon, shortcut and check mark. Rows are 32px high; the label truncates rather than wraps. Rules: UX Elements & Rules → MenuItem.
Add it to a page
Load the pinned file once in your Latitude Site or web page, then use the tag.
<script type="module" src="https://web-components.sites.latd.com/components/lat-menu-item/0.1.0/lat-menu-item.js"></script>The file is an ES module. It loads Lit, the design-system tokens and the Roobert stylesheet from this catalog once per page, however many components you use.
| Version | 0.1.0 |
|---|---|
| File | /components/lat-menu-item/0.1.0/lat-menu-item.js (1.7 KB gzipped) |
| SHA-256 | fdaf3cb7b598fa60c80d509c5a47c901f6ba8dcb010f0d0bc1b517c4c1a044e3 |
Rows only work inside a menu, and lat-menu.js already includes this file. Load it alone only to style rows somewhere a menu file isn't loaded yet.
Permutations
Shown in menus that stay open in the page. Hover a row to see its hover state.
States
Dark
Default
Selected
Disabled
Light
Default
Selected
Disabled
<lat-menu inline aria-label="States">
<lat-menu-item><lat-icon slot="icon" name="edit" size="20"></lat-icon>Default</lat-menu-item>
<lat-menu-item selected checked><lat-icon slot="icon" name="edit" size="20"></lat-icon>Selected</lat-menu-item>
<lat-menu-item disabled><lat-icon slot="icon" name="edit" size="20"></lat-icon>Disabled</lat-menu-item>
</lat-menu>With and without an icon or shortcut
Dark
Rename
Duplicate
Copy link
Delete
Light
Rename
Duplicate
Copy link
Delete
<lat-menu inline aria-label="Clip actions">
<lat-menu-item>Rename</lat-menu-item>
<lat-menu-item><lat-icon slot="icon" name="copy" size="20"></lat-icon>Duplicate</lat-menu-item>
<lat-menu-item shortcut="⌘C"><lat-icon slot="icon" name="link" size="20"></lat-icon>Copy link</lat-menu-item>
<lat-menu-item shortcut="⌘⌫" disabled><lat-icon slot="icon" name="trash-bin" size="20"></lat-icon>Delete</lat-menu-item>
</lat-menu>Group labels, checkbox and radio rows
Dark
Newest first
Most viewed
Comments
Captions
Light
Newest first
Most viewed
Comments
Captions
<lat-menu inline aria-label="View options">
<lat-menu-item group="Sort by"></lat-menu-item>
<lat-menu-item type="radio" checked>Newest first</lat-menu-item>
<lat-menu-item type="radio">Most viewed</lat-menu-item>
<lat-menu-item group="Show"></lat-menu-item>
<lat-menu-item type="checkbox" checked>Comments</lat-menu-item>
<lat-menu-item type="checkbox">Captions</lat-menu-item>
</lat-menu>A long label
Dark
Holiday campaign creative test, second wave, all regions
Light
Holiday campaign creative test, second wave, all regions
<lat-menu inline aria-label="Studies">
<lat-menu-item><lat-icon slot="icon" name="folder" size="20"></lat-icon>Holiday campaign creative test, second wave, all regions</lat-menu-item>
</lat-menu>Attributes
| Attribute | Values | Notes |
|---|---|---|
value | text | Reported in the menu's select event and submitted by a select. Defaults to the label. |
type | item (default), checkbox, radio | Checkbox rows flip checked when chosen. Radio rows check themselves and clear the other radio rows under the same group label. |
checked | boolean | Shows the check mark. |
selected | boolean | The selected fill, for the current choice. |
disabled | boolean | Can't be chosen. Still reachable with the arrow keys, so it can be read. |
shortcut | text | The keyboard shortcut, shown on the right. |
group | text | Makes the row a group label. Keyboard navigation skips it. |
Slots
| Slot | Notes |
|---|---|
| (default) | The label. |
icon | A 20px icon before the label, usually <lat-icon size="20">. |