Menu Item
A single selectable row inside fandry-menu.
fandry-menu-item
Example
Link to section ExampleCustom colors and parts
Link to section Custom colors and partsThe same component with a few --fd-* tokens set around it and its parts restyled. The code is under Parts below.
Props
Link to section Props| Prop | Type | Default | Description |
|---|---|---|---|
value | string | '' | Value reported to onselect. |
label | string | '' | Visible label. |
disabled | boolean | false | Excludes the item from selection. |
Parts
Link to section PartsStyle the elements inside the component from your own CSS with ::part(). Every fandry component renders in native shadow DOM, so parts work on LWR and Salesforce alike. For colors, spacing, radius and type across many components, set the --fd-* tokens instead. The code for the "Custom colors and parts" example above:
| Part | Description |
|---|---|
base | The outermost element. |
States are extra names on a part while the state is on. Name both to style one state, e.g.fandry-checkbox::part(control checked).
| State | Description |
|---|---|
disabled | A control, option or item that cannot be used. |
<!-- template -->
<div class="brand narrow">
<fandry-menu>
<fandry-menu-item value="edit" label="Edit order"></fandry-menu-item>
<fandry-menu-item value="track" label="Track package"></fandry-menu-item>
<fandry-menu-item value="cancel" label="Cancel order" class="danger"></fandry-menu-item>
</fandry-menu>
</div>
/* css */
/* Scoped to this demo. Set the same --fd-* tokens on :root to theme
every fandry-* component on the site. */
.brand {
--fd-bg-muted: 160 40% 94%;
--fd-radius-sm: 0.5rem;
}
fandry-menu::part(base) {
padding: 0.375rem;
border: 1px solid hsl(160 30% 85%);
border-radius: 0.75rem;
}
fandry-menu-item::part(base) {
font-weight: 600;
}
fandry-menu-item.danger::part(base) {
color: hsl(0 72% 42%);
}
Code
Link to section Code<fandry-menu-item value="edit" label="Edit"></fandry-menu-item>