MenuSeparator
A non-interactive separator between groups of menu items.
Usage
Use inside MenuList.
<MenuList>
<MenuSeparator {...props} />
</MenuList>Anatomy
The class attribute values represent part names. Other attributes represent their corresponding props.
<div class="whole" {...rest} role="separator" aria-orientation={ariaOrientation}></div>When embedded in MenuList, variant defaults to the menu's and styling falls back to it. ariaOrientation is ARIA-only: by default a vertical menu renders a horizontal separator, and a horizontal menu renders a vertical separator.
Props
| Name | Type | Default | Description |
|---|---|---|---|
ariaOrientation | <enum> | - | ARIA-only orientation; by default inferred opposite to the containing MenuList orientation |
attach | Attachment | - | Svelte attachment on the root separator |
element | HTMLDivElement | - | Bindable root element |
styling | SVSClass | - | Styling override |
variant | SVSVariant | NEUTRAL | Separator variant |
Other HTMLAttributes are passed to <div> via rest props; class is merged onto the root.
Styling
To learn more, see Styling.
Variant Management
No automatic switching.
Default Class Name
svs-menu-separator
Behavior
When embedded in MenuList, variant defaults to the menu's and styling falls back to it. ariaOrientation is ARIA-only: by default a vertical menu renders a horizontal separator, and a horizontal menu renders a vertical separator.
Accessibility
ARIA Roles and Attributes
The component applies these automatically:
- Separator (
whole<div>):role="separator"andaria-orientation.
aria-orientation defaults from the enclosing MenuList orientation, or from the ariaOrientation prop when supplied.
Exports
Types
interface MenuSeparatorProps extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "role" | "aria-orientation"> {
ariaOrientation?: "horizontal" | "vertical"; // inferred from MenuList orientation when absent
attach?: Attachment<HTMLDivElement>;
element?: HTMLDivElement; // bindable
styling?: SVSClass;
variant?: SVSVariant; // (VARIANT.NEUTRAL)
// other HTMLAttributes are passed to <div> via ...rest; `class` is merged onto root
// role and aria-orientation are component-owned
}
type MenuSeparatorReqdProps = never;
type MenuSeparatorBindProps = "element";Others
No additional exports are available.
Examples
The example code uses Tailwind CSS along with SVSClass.