2026-11-19 16:05:56 +08:00

2.2 KiB

RMoreDropdown

Wraps NDropdown with a default more-actions icon for row actions. options, trigger, placement, onSelect(key, option), and controlled visibility follow Naive UI Dropdown.

Interactive example

::: details View example source <<< @/examples/MoreDropdownDemo.vue :::

Prop Default Description
icon 'action/more' IconName using the full group-qualified path.
iconSize RIcon default Trigger icon size. Omission uses 20 px.
cursor 'inherit' Inherits the parent control's pointer style.
triggerLabel Injected translation or 'More actions' Accessible name of the default icon button.

The default trigger is a keyboard-focusable icon button. placement defaults to 'bottom-start' and can be overridden. The default slot replaces the entire trigger. Give a custom native button or NButton an accessible name. Stop click propagation as needed in a row so opening the menu does not also navigate.

import { RIcon, RMoreDropdown } from '@/components'
import { NButton } from 'naive-ui'

export const renderRowActions = (edit: () => void) => (
  <RMoreDropdown
    trigger="click"
    placement="bottom-end"
    options={[{ key: 'edit', label: 'Edit' }]}
    onSelect={(key) => {
      if (key === 'edit') edit()
    }}
  >
    <NButton
      text
      aria-label="More actions"
      onClick={(event) => event.stopPropagation()}
    >
      <RIcon name="action/more" />
    </NButton>
  </RMoreDropdown>
)

Component implementation · Props