suiss/ui
  • Docs
  • Components
  • Patterns
  • Interactions
  • Charts
  • Blocks
  • AI
GitHubCreate
DocsComponentsPatternsInteractionsChartsBlocksAICreate
Components84
  • Overview
  • Accordion
  • Alert
  • Alert Dialog
  • Alert Sheet
  • Amount Input
  • Aspect Ratio
  • Attachment
  • Avatar
  • Badge
  • Bottom Bar
  • Breadcrumb
  • Bubble
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Chip
  • Code Block
  • Collapsible
  • Combobox
  • Command
  • Context Menu
  • Dialog
  • Direction
  • Drawer
  • Dropdown Menu
  • Empty
  • FAB
  • Field
  • Fullscreen Menu
  • Haptics
  • Header
  • Hover Card
  • Icon
  • Input
  • Input Accessory Bar
  • Input Group
  • Input OTP
  • Item
  • Kbd
  • Keyboard Scroll View
  • Keypad
  • Label
  • Marker
  • Menubar
  • Message
  • Message Scroller
  • Native Select
  • Navigation Menu
  • Page Indicator
  • Pagination
  • Pin Pad
  • Popover
  • Progress
  • QR Scanner
  • Questionnaire
  • Radio Group
  • Resizable
  • Screen
  • Scroll Area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature Pad
  • Skeleton
  • Slider
  • Spinner
  • Switch
  • Tab Bar
  • Table
  • Tabs
  • Text
  • Textarea
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Trace
  • Wheel Picker
  • Widget

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.

import * as React from "react"
import {
  FullscreenMenu,
  FullscreenMenuContent,
  FullscreenMenuGroup,
  FullscreenMenuLabel,
  FullscreenMenuLink,
  FullscreenMenuTitle,
  FullscreenMenuTrigger,
} from "@/components/ui/fullscreen-menu"

export default function FullscreenMenuDemo() {
  const [active, setActive] = React.useState("Store")

  return (
    <div className="flex h-14 items-center justify-between px-4">

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

$ pnpm dlx shadcn@latest add @esuiss/fullscreen-menu

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add fullscreen-menu
  1. Install the following dependencies and add the cn helper:
$ pnpm add @base-ui/react
  1. Add the pieces it builds on: Button.

  2. Copy and paste the following code into your project.

components/ui/fullscreen-menu.tsx
"use client"

import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import * as React from "react"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"

type FullscreenMenuProps = {
  open?: boolean
  defaultOpen?: boolean
  onOpenChange?: (open: boolean) => void
}

type FullscreenMenuContextProps = {
  1. Update the import paths to match your project setup.

Usage

import {
  FullscreenMenu,
  FullscreenMenuClose,
  FullscreenMenuContent,
  FullscreenMenuGroup,
  FullscreenMenuLabel,
  FullscreenMenuLink,
  FullscreenMenuTitle,
  FullscreenMenuTrigger,
} from "@/components/ui/fullscreen-menu"
<FullscreenMenu>
  <FullscreenMenuTrigger aria-label="Menu" />
  <FullscreenMenuContent>
    <FullscreenMenuTitle>Menu</FullscreenMenuTitle>
    <FullscreenMenuGroup>
      <FullscreenMenuLink href="#store" isActive>
        Store
      </FullscreenMenuLink>
      <FullscreenMenuLink href="#products">Products</FullscreenMenuLink>
    </FullscreenMenuGroup>
    <FullscreenMenuGroup>
      <FullscreenMenuLabel>Shop</FullscreenMenuLabel>
      <FullscreenMenuLink href="#shop-online">Shop online</FullscreenMenuLink>
      <FullscreenMenuLink href="#order-status">Order status</FullscreenMenuLink>
    </FullscreenMenuGroup>
  </FullscreenMenuContent>
</FullscreenMenu>

Examples

Links only

A menu with a single group of primary links and no FullscreenMenuLabel, so every link renders at the larger size.

import * as React from "react"
import {
  FullscreenMenu,
  FullscreenMenuContent,
  FullscreenMenuGroup,
  FullscreenMenuLink,
  FullscreenMenuTitle,
  FullscreenMenuTrigger,
} from "@/components/ui/fullscreen-menu"

export default function FullscreenMenuLinksOnly() {
  const [active, setActive] = React.useState("Store")

  return (
    <div className="flex h-14 items-center justify-between px-4">
      <span className="font-semibold">Acme</span>

With close label

Set closeLabel="Done" on FullscreenMenuContent to show the text Done instead of the close icon.

import * as React from "react"
import {
  FullscreenMenu,
  FullscreenMenuContent,
  FullscreenMenuGroup,
  FullscreenMenuLabel,
  FullscreenMenuLink,
  FullscreenMenuTitle,
  FullscreenMenuTrigger,
} from "@/components/ui/fullscreen-menu"

export default function FullscreenMenuWithCloseLabel() {
  const [active, setActive] = React.useState("Store")

  return (
    <div className="flex h-14 items-center justify-between px-4">

Accessibility

  • The panel has the dialog role and takes its name from FullscreenMenuTitle, 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 sets aria-expanded while 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 Close label.
  • The active link sets aria-current="page".

API Reference

FullscreenMenu

The root that manages the menu's open state.

PropTypeDefault
openboolean-
defaultOpenbooleanfalse
onOpenChange(open: boolean) => void-
PropTypeDefault
isOpenboolean-
defaultOpenbooleanfalse
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.

PropTypeDefault
showCloseButtonbooleantrue
closeLabelstring-

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.

PropTypeDefault
isActivebooleanfalse

Also accepts the props of useRender.ComponentProps<"a">.

Use the render prop to render a router link instead of an anchor.

PropTypeDefault
asChildbooleanfalse

Also accepts the props of React.ComponentProps<"a">.

Set asChild and pass a router link as the child to render it as the link.

PropTypeDefault
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.

NextHapticsPreviousField

On this page

  1. 01Installation
  2. 02Usage
  3. 03Examples
    • Links only
    • With close label
  4. 04Accessibility
  5. 05API Reference
    • FullscreenMenu
    • FullscreenMenuTrigger
    • FullscreenMenuContent
    • FullscreenMenuTitle
    • FullscreenMenuGroup
    • FullscreenMenuLabel
    • FullscreenMenuLink
    • FullscreenMenuClose