suiss/ui ยท Component
Fullscreen Menu
A navigation menu that covers the whole screen, for site links on small viewports.
Fullscreen Menu is an open-source component from suiss/ui for React. The @esuiss/ui CLI copies its source into your project, so you own the code.
Fullscreen menu is built on the dialog primitive of the chosen base. The FullscreenMenu root manages the open state, and FullscreenMenuTrigger renders a menu button whose two-line icon animates into a close icon. FullscreenMenuContent covers the viewport and reveals from the top, with a sticky header that holds the close button. Inside it, FullscreenMenuTitle names the menu, FullscreenMenuGroup holds a list of FullscreenMenuLink items, and FullscreenMenuLabel adds a caption to a group. Links and labels fade in with a staggered delay as the menu opens.
Use it for the primary navigation of a website on phones, like the global navigation on apple.com. For a short list of actions, use a dropdown menu; for a panel that keeps part of the page visible, use a drawer or sheet.
Installation
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Usage
Examples
Links only
A menu with a single group of primary links and no FullscreenMenuLabel, so every link renders at the larger size.
With close label
Set closeLabel="Done" on FullscreenMenuContent to show the text Done instead of the close icon.
Accessibility
- The panel has the
dialogrole and takes its name fromFullscreenMenuTitle, which is visually hidden. Always include one. - The trigger has no text of its own, so give it an accessible name with
aria-label. It setsaria-expandedwhile the menu is open. - Opening the menu moves focus inside it. Escape closes it and returns focus to the trigger.
- The icon-only close button has a visually hidden
Closelabel. - The active link sets
aria-current="page".
API Reference
FullscreenMenu
The root that manages the menu's open state.
| Prop | Type | Default |
|---|---|---|
open | boolean | - |
defaultOpen | boolean | false |
onOpenChange | (open: boolean) => void | - |
| Prop | Type | Default |
|---|---|---|
isOpen | boolean | - |
defaultOpen | boolean | false |
onOpenChange | (isOpen: boolean) => void | - |
Also accepts the props of the primitive part it wraps.
The menu is uncontrolled by default; set defaultOpen to start open, or control it with open and onOpenChange, which is called when the menu opens or closes.
The menu is uncontrolled by default; set defaultOpen to start open, or control it with isOpen and onOpenChange, which is called when the menu opens or closes.
FullscreenMenuTrigger
The menu button, with an icon that animates between menu and close states.
Also accepts the props of the primitive part it wraps.
FullscreenMenuContent
The full-screen panel, with a sticky header that holds the close button.
| Prop | Type | Default |
|---|---|---|
showCloseButton | boolean | true |
closeLabel | string | - |
Also accepts the props of the primitive part it wraps.
showCloseButton shows the header with a close button at the top of the menu, and closeLabel replaces the close button's icon with text. The content respects safe-area insets, and animations are disabled when reduced motion is preferred.
FullscreenMenuTitle
The menu's title, visually hidden and used as its accessible name.
Also accepts the props of the primitive part it wraps.
FullscreenMenuGroup
A list of links, animated in sequence.
Also accepts the props of React.ComponentProps<"div">.
Groups that contain a FullscreenMenuLabel render their links smaller than groups without one, so the first group reads as primary navigation. The stagger delay is computed from a link's position in its group, for up to 10 links, and the group's position in the menu, for up to 6 sections.
FullscreenMenuLabel
A caption for a group of links.
Also accepts the props of React.ComponentProps<"div">.
FullscreenMenuLink
A navigation link that closes the menu when chosen.
| Prop | Type | Default |
|---|---|---|
isActive | boolean | false |
Also accepts the props of useRender.ComponentProps<"a">.
Use the render prop to render a router link instead of an anchor.
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
Also accepts the props of React.ComponentProps<"a">.
Set asChild and pass a router link as the child to render it as the link.
| Prop | Type | Default |
|---|---|---|
render | (props) => React.ReactNode | - |
Also accepts the props of React.ComponentProps<"a">.
Pass a render function that returns a router link with the props it receives.
Set isActive on the link for the current page. It sets aria-current="page", data-active and the text-primary color.
FullscreenMenuClose
A button that closes the menu from any element.
Also accepts the props of the primitive part it wraps.
Each part sets a data-slot, such as fullscreen-menu-content or fullscreen-menu-link, for styling.