JGuang / JGuang UI
Components组件Radix UIRadix UI 组件

Dropdown Menu

Displays a menu to the user — such as a set of actions or functions — triggered by a button.

Partially translated: Chinese navigation, titles, descriptions, and common headings. The technical body is currently in English.
Loading JGuang UI example…

Installation

Command

Manual

Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.

Install the following dependencies:

npm install radix-ui

Copy and paste the following code into your project.

View complete source: components/ui/dropdown-menu.tsx

Update the import paths to match your project setup.

Usage

import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuGroup,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
<DropdownMenu>
  <DropdownMenuTrigger asChild>
    <Button variant="outline">Open</Button>
  </DropdownMenuTrigger>
  <DropdownMenuContent>
    <DropdownMenuGroup>
      <DropdownMenuLabel>My Account</DropdownMenuLabel>
      <DropdownMenuItem>Profile</DropdownMenuItem>
      <DropdownMenuItem>Billing</DropdownMenuItem>
    </DropdownMenuGroup>
    <DropdownMenuSeparator />
    <DropdownMenuGroup>
      <DropdownMenuItem>Team</DropdownMenuItem>
      <DropdownMenuItem>Subscription</DropdownMenuItem>
    </DropdownMenuGroup>
  </DropdownMenuContent>
</DropdownMenu>

Composition

Use the following composition to build a DropdownMenu:

DropdownMenu
├── DropdownMenuTrigger
└── DropdownMenuContent
    ├── DropdownMenuGroup
    │   ├── DropdownMenuLabel
    │   ├── DropdownMenuItem
    │   └── DropdownMenuItem
    ├── DropdownMenuSeparator
    ├── DropdownMenuGroup
    │   ├── DropdownMenuLabel
    │   ├── DropdownMenuCheckboxItem
    │   └── DropdownMenuCheckboxItem
    ├── DropdownMenuSeparator
    ├── DropdownMenuGroup
    │   ├── DropdownMenuLabel
    │   └── DropdownMenuRadioGroup
    │       ├── DropdownMenuRadioItem
    │       └── DropdownMenuRadioItem
    └── DropdownMenuSub
        ├── DropdownMenuSubTrigger
        └── DropdownMenuSubContent
            └── DropdownMenuGroup
                ├── DropdownMenuLabel
                ├── DropdownMenuItem
                └── DropdownMenuItem

Basic

A basic dropdown menu with labels and separators.

Loading JGuang UI example…

Use DropdownMenuSub to nest secondary actions.

Loading JGuang UI example…

Shortcuts

Add DropdownMenuShortcut to show keyboard hints.

Loading JGuang UI example…

Icons

Combine icons with labels for quick scanning.

Loading JGuang UI example…

Checkboxes

Use DropdownMenuCheckboxItem for toggles.

Loading JGuang UI example…

Checkboxes Icons

Add icons to checkbox items.

Loading JGuang UI example…

Radio Group

Use DropdownMenuRadioGroup for exclusive choices.

Loading JGuang UI example…

Radio Icons

Show radio options with icons.

Loading JGuang UI example…

Destructive

Use variant="destructive" for irreversible actions.

Loading JGuang UI example…

Avatar

An account switcher dropdown triggered by an avatar.

Loading JGuang UI example…

Complex

A richer example combining groups, icons, and submenus.

Loading JGuang UI example…

RTL

To enable RTL support in JGuang UI, see the RTL configuration guide.

Loading JGuang UI example…

API Reference

See the Radix UI documentation for the full API reference.

Source: components/radix/dropdown-menu.mdx

Technical documentation for JGuang UI.

On this page