VerticalMenuButton is the one supported child of VerticalMenu. It is a Container rendered as a button by default, laying out an optional leading icon next to a text label. Its width is filled from the menu so every row lines up, and its height grows with the label, which wraps rather than truncating.text. You own the label, the icon, the disabled state, and the activation handler.import { VerticalMenu, VerticalMenuButton } from '@wearables-ui-toolkit/mrbd';
<VerticalMenu aria-label="Photo actions" onDismissRequest={closeMenu}>
<VerticalMenuButton
text="Add to album"
icon={bookmarkIcon}
onClick={event => activateItem(event, addToAlbum)}
/>
<VerticalMenuButton
text="Hide from feed"
icon={eyeOffIcon}
disabled={!canHide}
onClick={event => activateItem(event, hideFromFeed)}
/>
</VerticalMenu>;
as to change the rendered element. The row keeps its menu-item role, material, and keyboard behavior, and the forwarded ref is typed by whatever you render as.import { useRef } from 'react';
import { Link } from 'react-router-dom';
import { VerticalMenu, VerticalMenuButton } from '@wearables-ui-toolkit/mrbd';
export function SettingsMenu({ onDismiss }: { onDismiss: () => void }) {
const settingsRef = useRef<HTMLAnchorElement>(null);
return (
<VerticalMenu aria-label="More" onDismissRequest={onDismiss}>
<VerticalMenuButton
as={Link}
ref={settingsRef}
to="/settings"
text="Settings"
icon={gearIcon}
/>
</VerticalMenu>
);
}
VerticalMenuButtonProps. It is ContainerProps with ariaLabel, children, height, material, role, and width removed — those belong to the component — plus the two own props below.| Prop | Type | Default | Description |
|---|---|---|---|
text | string | Required | The label. Also becomes the row’s accessible name. |
icon | IconSource | — | Optional decorative leading icon. When omitted, the icon slot and its gap collapse and the label moves to the start of the row. |
focusable, onLongPress, onStateChange, the tooltip props, and so on. These are the ones that matter most here.| Prop | Type | Default | Description |
|---|---|---|---|
as | ElementType | 'button' | Element or component to render as, for example a router link. |
type | 'button' \| 'reset' \| 'submit' | 'button' when rendered as a button, otherwise unset | Submit behavior of the underlying button element. |
onClick | MouseEventHandler | — | Activation handler. Receives the DOM event so you can stop it from reaching the trigger. |
onActivate | (event: InteractableActivationEvent) => void | — | Fires once per activation and reports the originating pointer or keyboard event. |
disabled | boolean | false | Renders the unavailable state, blocks activation, and removes the row from the menu’s arrow movement. |
shapeProvider | ShapeProvider | Small rounded rectangle | Geometry used for clipping and material paths. |
aria-label | string | Falls back to text | Overrides the derived accessible name. Use it only when the visible label would read badly on its own. |
className | string | '' | Extra class on the row root. |
style | CSSProperties | — | Inline styles on the row root. |
--uit-color-icon-primary. With no icon, both the slot and the gap collapse, so a menu of label-only rows stays aligned to the start of the row.button with type="button", so it never submits an enclosing form. When you pass as, the component renders that element instead and only defaults type for a real button.as.role="menuitem" and is named by its text; pass aria-label to override that name.as with your router’s link component when a row navigates, so it gets a real href.aria-label to say something the visible label does not.