Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@chakra-ui/menu

Package Overview
Dependencies
Maintainers
3
Versions
556
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chakra-ui/menu

A React component to render accessible menus

  • 0.0.0-dev-20230424202839
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
481K
decreased by-6.45%
Maintainers
3
Weekly downloads
 
Created

What is @chakra-ui/menu?

@chakra-ui/menu is a component library for creating accessible and customizable menu components in React applications. It is part of the Chakra UI library, which provides a set of accessible, reusable, and composable React components.

What are @chakra-ui/menu's main functionalities?

Basic Menu

This code demonstrates how to create a basic menu with a button that triggers a dropdown list of menu items.

```jsx
import { Menu, MenuButton, MenuList, MenuItem, Button } from '@chakra-ui/react';

function BasicMenu() {
  return (
    <Menu>
      <MenuButton as={Button}>
        Actions
      </MenuButton>
      <MenuList>
        <MenuItem>Download</MenuItem>
        <MenuItem>Create a Copy</MenuItem>
        <MenuItem>Mark as Draft</MenuItem>
        <MenuItem>Delete</MenuItem>
        <MenuItem>Attend a Workshop</MenuItem>
      </MenuList>
    </Menu>
  );
}
```

Menu with Submenu

This code demonstrates how to create a menu with grouped items and a submenu, providing a more organized structure for menu options.

```jsx
import { Menu, MenuButton, MenuList, MenuItem, MenuGroup, MenuDivider, Button } from '@chakra-ui/react';

function MenuWithSubmenu() {
  return (
    <Menu>
      <MenuButton as={Button}>
        File
      </MenuButton>
      <MenuList>
        <MenuGroup title="Profile">
          <MenuItem>My Account</MenuItem>
          <MenuItem>Payments </MenuItem>
        </MenuGroup>
        <MenuDivider />
        <MenuGroup title="Help">
          <MenuItem>Docs</MenuItem>
          <MenuItem>FAQ</MenuItem>
        </MenuGroup>
      </MenuList>
    </Menu>
  );
}
```

Menu with Icons

This code demonstrates how to add icons to menu items, enhancing the visual appeal and usability of the menu.

```jsx
import { Menu, MenuButton, MenuList, MenuItem, Button } from '@chakra-ui/react';
import { FaDownload, FaCopy, FaTrash } from 'react-icons/fa';

function MenuWithIcons() {
  return (
    <Menu>
      <MenuButton as={Button}>
        Actions
      </MenuButton>
      <MenuList>
        <MenuItem icon={<FaDownload />}>Download</MenuItem>
        <MenuItem icon={<FaCopy />}>Create a Copy</MenuItem>
        <MenuItem icon={<FaTrash />}>Delete</MenuItem>
      </MenuList>
    </Menu>
  );
}
```

Other packages similar to @chakra-ui/menu

Keywords

FAQs

Package last updated on 24 Apr 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc