Menu Divider
- Stable
- WCAG 2.2 evidence
- RTL
- Web · iOS · Android
Separates groups of items in a Menu or ContextMenu. Built on React Aria Separator, so it
takes part in the menu's collection (role separator, skipped by the arrow keys). Put destructive actions last,
after a divider; do not place one between every item. It is a client component because React Aria collections only render parts that register with them.
import { MenuDivider } from "@nexera-ui/react";- 3
- examples
- 7
- props
- 1
- live controls
- 3
- platforms
- 2
- WCAG criteria
- 2
- blocks use it
Try every prop. Copy the code.
Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.
import { MenuDivider } from "@nexera-ui/react";
<MenuDivider />Examples 2
The same examples as Storybook, rendered live. Open Code to copy one.
Platforms
Web and Android use the 1 px line; iOS uses the 8 pt group separator of the Figma System menu.
import { type ReactNode } from "react";
import { AriaMenu } from "react-aria-components";
import {
MenuDivider,
MenuItem,
menuListStyles,
menuPopoverStyles,
usePlatform,
} from "@nexera-ui/react";
import { LuPencil, LuTrash2 } from "react-icons/lu";
const platforms = ["web", "ios", "android"] as const;
function StaticMenu({
platform: platformProp,
label,
children,
}: {
platform?: Platform | undefined;
label: string;
children: ReactNode;
}) {
const platform = usePlatform(platformProp);
return (
<div data-platform={platform} className={menuPopoverStyles({ platform })}>
<MenuPlatformContext.Provider value={platform}>
<AriaMenu aria-label={label} className={menuListStyles({ platform })}>
{children}
</AriaMenu>
</MenuPlatformContext.Provider>
</div>
);
}
export function Platforms() {
return (
<div className="flex flex-wrap items-start gap-6">
{platforms.map((platform) => (
<StaticMenu key={platform} label={`File (${platform})`} platform={platform}>
<MenuItem id="edit" label="Edit" icon={<LuPencil />} />
<MenuDivider />
<MenuItem id="delete" label="Delete" type="destructive" icon={<LuTrash2 />} />
</StaticMenu>
))}
</div>
);
}
Standalone
Outside a menu it renders a reset <hr> (no UA margin or inset border).
import { MenuDivider } from "@nexera-ui/react";
export function Standalone() {
return (
<div className="w-60">
<MenuDivider />
</div>
);
}
Props 7
Press "Try it" on a card to load that prop into the playground.
7 props shown
platformNexera"web" | "ios" | "android"Platform look: a 1 px line on web and Android, the 8 pt group separator on iOS. Defaults to the
platform of the enclosing Menu, then of the NexeraProvider.
classNameNexerastringExtra classes, merged last so they win over the defaults.
styleNexeraCSSPropertiesInline style.
idReact AriastringThe element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
aria-labelReact AriastringDefines a string value that labels the current element.
aria-labelledbyReact AriastringIdentifies the element (or elements) that labels the current element.
aria-describedbyReact AriastringIdentifies the element (or elements) that describes the object.
* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.
Accessible by default.
Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.
WCAG 2.2 evidence
2 direct · 0 supporting- 1.3.1Info and RelationshipsLevel A · tested directly
- 4.1.2Name, Role, ValueLevel A · tested directly
Fits any width.
Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.
Styling hooks
Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.
<MenuDivider className="shadow-sm" />Used in blocks
Related components
- BoardCardA Kanban card: avatar, name, role, drag handle and a detail line.
- ButtonTriggers an action such as Save, Submit, Approve or Delete.
- ButtonGroupItemOne toggle in a joined row of buttons, for example a List / Grid view switch or a set of filters.
- ContextMenuThe menu of actions for an element, opened where the user asks for it: right-click, long-press on touch screens, and from the keyboard with Shift+F10 or the ContextMenu key (the browser reports both as a `contextmenu` event on the focused element; on macOS, Control+Enter).
- DragHandleGrip that starts a drag of the collection item it sits in.
- DropIndicatorInsertion line shown between two items while something is dragged over a `GridList` or `ListBox`.
- IconButtonA square, icon-only button for compact actions such as Settings, Close or Delete row.
- MenuA list of actions or options that opens from a trigger.