New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@pras-ui/menu

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pras-ui/menu

> A low-level, headless component for building accessible menus and submenus. This package handles state management, keyboard interactions, and accessibility.

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

@pras-ui/menu

A low-level, headless component for building accessible menus and submenus. This package handles state management, keyboard interactions, and accessibility.

This package provides the core puzzle pieces for creating menu-type components like popups, dropdowns, and dialogs. It's designed to be composed with a positioning library (like @pras-ui/floating-kit) and an animation library (like @pras-ui/presence) to create fully-featured, interactive components.

Installation

npm install @pras-ui/menu

Usage

Here is a basic example of how to create a menu. Note that this package does not handle showing, hiding, or positioning the menu content. It is intended to be used with a presence component (like @pras-ui/presence) and a positioning component.

import React from 'react';
import {
  MenuRoot,
  MenuTrigger,
  MenuContent,
  MenuItem,
} from '@pras-ui/menu';

function MyMenu() {
  const [open, setOpen] = React.useState(false);

  return (
    <MenuRoot open={open} onOpenChange={setOpen}>
      <MenuTrigger>
        <button>Open Menu</button>
      </MenuTrigger>

      {open && (
        <MenuContent>
          <MenuItem onSelect={() => alert('Copying')}>Copy</MenuItem>
          <MenuItem onSelect={() => alert('Pasting')}>Paste</MenuItem>
        </MenuContent>
      )}
    </MenuRoot>
  );
}

Components

This package exports the following headless components:

Core Menu

  • MenuRoot: The root component that provides the context for the menu state.
  • MenuTrigger: The element that opens or closes the menu.
  • MenuContent: The wrapper for the menu items which handles keyboard navigation.
  • MenuItem: The individual selectable items in the menu.

Sub-Menu

  • SubMenuRoot: The root for a nested menu.
  • SubMenuTrigger: The MenuItem that opens a sub-menu.
  • SubMenuContent: The content wrapper for a sub-menu.

Choice Items

  • MenuChoice: A group of checkable or radio items.
  • MenuChoiceItem: A selectable item within a MenuChoice group.
  • MenuChoiceIndicator: A visual indicator for the selected state of a MenuChoiceItem.

Grouping

  • MenuGroup: A component to group related items.
  • MenuLabel: The label for a MenuGroup.

Keywords

react

FAQs

Package last updated on 09 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts