Installations
npm install @nextpy/menu
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Node Version
20.7.0
NPM Version
10.1.0
Score
30.6
Supply Chain
49
Quality
74.2
Maintenance
100
Vulnerability
99.3
License
Releases
@chakra-ui/react@3.8.1
Updated on Feb 19, 2025
@chakra-ui/panda-preset@3.8.1
Updated on Feb 19, 2025
@chakra-ui/cli@3.8.1
Updated on Feb 19, 2025
@chakra-ui/react@3.8.0
Updated on Feb 09, 2025
@chakra-ui/panda-preset@3.8.0
Updated on Feb 09, 2025
@chakra-ui/cli@3.8.0
Updated on Feb 09, 2025
Contributors
Languages
TypeScript (82.74%)
MDX (16.46%)
JavaScript (0.65%)
CSS (0.08%)
HTML (0.07%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
152
Last Day
1
Last Week
2
Last Month
14
Last Year
63
GitHub Statistics
MIT License
38,565 Stars
10,486 Commits
3,362 Forks
201 Watchers
12 Branches
682 Contributors
Updated on Feb 21, 2025
Package Meta Information
Latest Version
2.2.1
Package Id
@nextpy/menu@2.2.1
Unpacked Size
8.69 kB
Size
3.14 kB
File Count
3
NPM Version
10.1.0
Node Version
20.7.0
Published on
Nov 09, 2023
Total Downloads
Cumulative downloads
Total Downloads
152
Last Day
0%
1
Compared to previous day
Last Week
-50%
2
Compared to previous week
Last Month
366.7%
14
Compared to previous month
Last Year
-29.2%
63
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
15
Peer Dependencies
3
@chakra-ui/menu
An accessible dropdown menu for the common dropdown menu button design pattern. Menu uses roving tabIndex for focus management.
Installation
1yarn add @chakra-ui/menu 2 3# or 4 5npm i @chakra-ui/menu
Import components
1import { 2 Menu, 3 MenuButton, 4 MenuList, 5 MenuItem, 6 MenuGroup, 7 MenuDivider, 8 MenuOptionGroup, 9 MenuItemOption, 10} from "@chakra-ui/react"
Usage
1<Menu> 2 <MenuButton>Actions</MenuButton> 3 <MenuList> 4 <MenuItem>Download</MenuItem> 5 <MenuItem>Create a Copy</MenuItem> 6 <MenuItem>Mark as Draft</MenuItem> 7 <MenuItem>Delete</MenuItem> 8 <MenuItem as="a" href="#"> 9 Attend a Workshop 10 </MenuItem> 11 </MenuList> 12</Menu>
Accessing the internal state
To access the internal state of the Menu, use a function as a children
(commonly known as a render prop). You'll get access to the internal state
isOpen
and method onClose
.
1<Menu> 2 {({ isOpen }) => ( 3 <React.Fragment> 4 <MenuButton>{isOpen ? "Close" : "Open"}</MenuButton> 5 <MenuList> 6 <MenuItem>Download</MenuItem> 7 <MenuItem onClick={() => alert("Kagebunshin")}>Create a Copy</MenuItem> 8 </MenuList> 9 </React.Fragment> 10 )} 11</Menu>
Letter Navigation
When focus is on the MenuButton
or within the MenuList
and you type a letter
key, a search begins. Focus will move to the first MenuItem
that starts with
the letter you typed.
Open the menu, try and type any letter, say "S" to see the focus movement.
1<Menu> 2 <MenuButton 3 px={4} 4 py={2} 5 transition="all 0.2s" 6 borderRadius="md" 7 borderWidth="1px" 8 _hover={{ bg: "gray.100" }} 9 _expanded={{ bg: "red.200" }} 10 _focus={{ outline: 0, boxShadow: "outline" }} 11 > 12 File <ChevronDownIcon /> 13 </MenuButton> 14 <MenuList> 15 <MenuItem>New File</MenuItem> 16 <MenuItem>New Window</MenuItem> 17 <MenuDivider /> 18 <MenuItem>Open...</MenuItem> 19 <MenuItem>Save File</MenuItem> 20 </MenuList> 21</Menu>
Just another example.
1<Menu> 2 <MenuButton>Your Cats</MenuButton> 3 <MenuList> 4 <MenuItem minH="48px"> 5 <Image 6 size="2rem" 7 borderRadius="full" 8 src="https://placekitten.com/100/100" 9 alt="Fluffybuns the destroyer" 10 mr="12px" 11 /> 12 <span>Fluffybuns the Destroyer</span> 13 </MenuItem> 14 <MenuItem minH="40px"> 15 <Image 16 size="2rem" 17 borderRadius="full" 18 src="https://placekitten.com/120/120" 19 alt="Simon the pensive" 20 mr="12px" 21 /> 22 <span>Simon the pensive</span> 23 </MenuItem> 24 </MenuList> 25</Menu>
MenuGroup
To group related MenuItems
, use the MenuGroup
component and pass it a label
for the group name.
1<Menu> 2 <MenuButton>Profile</MenuButton> 3 <MenuList> 4 <MenuGroup title="Profile"> 5 <MenuItem>My Account</MenuItem> 6 <MenuItem>Payments </MenuItem> 7 </MenuGroup> 8 <MenuDivider /> 9 <MenuGroup title="Help"> 10 <MenuItem>Docs</MenuItem> 11 <MenuItem>FAQ</MenuItem> 12 </MenuGroup> 13 </MenuList> 14</Menu>
Menu option groups
You can compose a menu for table headers to help with sorting and filtering
options. Use the MenuOptionGroup
and MenuItemOption
components.
1<Menu closeOnSelect={false}> 2 <MenuButton>MenuItem</MenuButton> 3 <MenuList minWidth="240px"> 4 <MenuOptionGroup defaultValue="asc" title="Order" type="radio"> 5 <MenuItemOption value="asc">Ascending</MenuItemOption> 6 <MenuItemOption value="desc">Descending</MenuItemOption> 7 </MenuOptionGroup> 8 <MenuDivider /> 9 <MenuOptionGroup title="Country" type="checkbox"> 10 <MenuItemOption value="email">Email</MenuItemOption> 11 <MenuItemOption value="phone">Phone</MenuItemOption> 12 <MenuItemOption value="country">Country</MenuItemOption> 13 </MenuOptionGroup> 14 </MenuList> 15</Menu>
closeOnSelect
MenuItem
and MenuItemOption
can use the closeOnSelect
prop to override
their parent Menu
's behavior.
1<Menu> 2 <MenuButton>Open Menu</MenuButton> 3 <MenuList> 4 <MenuGroup title="Profile"> 5 {/* Clicking on those items will close the menu (default behavior) */} 6 <MenuItem>My Account</MenuItem> 7 <MenuItem>Payments</MenuItem> 8 </MenuGroup> 9 <MenuDivider /> 10 <MenuOptionGroup title="Country" type="checkbox"> 11 {/* Clicking on those items will keep the menu open */} 12 <MenuItemOption value="email" closeOnSelect={false}> 13 Email 14 </MenuItemOption> 15 <MenuItemOption value="phone" closeOnSelect={false}> 16 Phone 17 </MenuItemOption> 18 <MenuItemOption value="country" closeOnSelect={false}> 19 Country 20 </MenuItemOption> 21 </MenuOptionGroup> 22 </MenuList> 23</Menu>

No vulnerabilities found.
Reason
30 commit(s) and 13 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
no binaries found in the repo
Reason
Found 10/21 approved changesets -- score normalized to 4
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: topLevel 'actions' permission set to 'write': .github/workflows/issue-stale.yml:10
- Warn: no topLevel permission defined: .github/workflows/quality.yml:1
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/issue-stale.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/chakra-ui/chakra-ui/issue-stale.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/quality.yml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/chakra-ui/chakra-ui/quality.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/quality.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/chakra-ui/chakra-ui/quality.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/quality.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/chakra-ui/chakra-ui/quality.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/quality.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/chakra-ui/chakra-ui/quality.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/quality.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/chakra-ui/chakra-ui/quality.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/chakra-ui/chakra-ui/release.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/chakra-ui/chakra-ui/release.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/chakra-ui/chakra-ui/release.yml/main?enable=pin
- Info: 0 out of 8 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 20 are checked with a SAST tool
Reason
11 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-x4c5-c7rf-jjgv
- Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q
- Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38
- Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-c76h-2ccp-4975
- Warn: Project is vulnerable to: GHSA-9crc-q9x8-hgqq
Score
4.2
/10
Last Scanned on 2025-02-17
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More