• Docs
  • Blog
    • 0.24.0

    • Switch to dark mode
    Get Started
    Components
    Styling
    Theming

    Concepts

    OverviewCompositionTesting

    Layout

    Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrap

    Components

    AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

    Utilities

    Feature FlagsForLocal StoragePortalShowsplitPropsTheme

    Menu

    A menu component for displaying a list of options.

    • npm
    • source
    • recipe
    • Ark
    import {
    Menu,
    MenuTrigger,
    MenuContent,
    MenuItem,
    MenuItemGroup,
    MenuGroupLabel,
    MenuSeparator,
    } from '@cerberus/react'

    Usage

    Item 1
    Item 2

    NextJS Usage

    To create a nav menu with NextJS, you should use the Link component from next/link combined with the asChild prop.

    Item 1Item 2
    Sign out

    Grouped Menu

    You can group menu items by using the MenuItemGroup component.

    Group Label

    Item 1
    Item 2

    Positions

    The Menu component accepts a positioning prop to determine where the menu will be positioned relative to the trigger. See available positions.

    Item 1
    Item 2
    Item 1
    Item 2
    Item 1
    Item 2
    Item 1
    Item 2

    Primitives

    You can utilize the primitive components or the css prop to customize the menu.

    ComponentDescription
    MenuRootThe context provider for the menu parts
    MenuTriggerThe trigger that opens the menu content
    MenuTriggerItemThe item that triggers a nested menu content
    MenuIndicatorThe indicator for the selected menu item
    MenuPositionerThe positioning container for the menu content
    MenuContentThe content of the menu
    MenuItemA single item of the menu
    MenuItemGroupA container for a group of menu items
    MenuItemGroupLabelThe label for a group of menu items
    MenuSeparatorA separator between menu items
    Hades am I
    Hades is also where I live

    API

    Menu

    export interface MenuProps {
    positioning?: {
    placement: 'left' | 'right' | 'top' | 'bottom'
    }
    }
    NameDefaultDescription
    positioningnullUsed to position the menu content.

    MenuTrigger

    export interface MenuTriggerProps {
    children: React.ReactNode
    }
    NameDefaultDescription
    childrennullThe trigger element.

    MenuItem

    export interface MenuItemProps {
    children: React.ReactNode
    value: string
    asChild?: boolean
    }
    NameDefaultDescription
    childrennullThe content of the menu item.
    valuenullThe value of the menu item used for selection.
    asChildfalseUsed to render the children as a child component.

    On this page

    • Edit this page on Github
    Cerberus Design System | Docs