Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

A menu of actions

Put the row's actions behind one icon trigger, and label the trigger so a screen reader names the menu.

Row actions behind a trigger
The trigger is icon-only, so set label to name the menu, such as “Row actions” or “More options”. Without it a screen reader announces an unlabelled button. Menu items are inner content: a button with the dropdown-item class for an action, an a with that class for navigation, and an app-dropdown-item with tone danger for a destructive one. A plain hr with the dropdown-divider class renders a separator.
Show code
<app-dropdown icon="more-horizontal" label="Row actions">
    <button class="dropdown-item" type="button">View details</button>
    <button class="dropdown-item" type="button">Rename</button>
    <button class="dropdown-item" type="button">Archive</button>
</app-dropdown>

Icons and shortcuts

Give items an icon or a key so the menu scans quickly.

Icon per item
Show code
<app-dropdown icon="more-horizontal" label="Row actions">
    <button class="dropdown-item" type="button"><app-icon name="pencil"></app-icon> Edit</button>
    <button class="dropdown-item" type="button"><app-icon name="files"></app-icon> Duplicate</button>
    <button class="dropdown-item" type="button"><app-icon name="download"></app-icon> Export</button>
</app-dropdown>
External logos as item icons
An image icon takes any URL: an external CDN link, an uploaded avatar or a data URI. It renders sized to match the glyph items, so a menu can mix logos and icons.
Show code
<app-dropdown icon="plus" label="Add integration">
    <button class="dropdown-item" type="button"><img src="https://cdn.example.com/slack.png" alt="" /> Slack</button>
    <button class="dropdown-item" type="button"><img src="https://cdn.example.com/github.png" alt="" /> GitHub</button>
</app-dropdown>
Keys beside the actions
Show code
<app-dropdown icon="more-horizontal" label="Request actions">
    <app-dropdown-item icon="eye" shortcut="Enter">Open</app-dropdown-item>
    <app-dropdown-item icon="box-seam" shortcut="e">Archive</app-dropdown-item>
    <app-dropdown-item icon="user" shortcut="i">Assign to me</app-dropdown-item>
</app-dropdown>
Two-line items
Show code
<app-dropdown icon="more-horizontal" label="Row actions">
    <app-dropdown-item icon="archive" description="Move to the archive">Archive</app-dropdown-item>
    <app-dropdown-item icon="files" description="Copy with its settings">Duplicate</app-dropdown-item>
    <app-dropdown-item icon="trash-2" tone="Danger" description="Cannot be undone">Delete</app-dropdown-item>
</app-dropdown>

Destructive and disabled

Place a danger item last, and give a disabled item a reason the person can read on hover or focus.

A danger item, placed last
A menu item is a single click away from firing. Route a delete or remove item through AppConfirmDialog so the action cannot run by accident.
Show code
<app-dropdown icon="more-horizontal" label="Row actions">
    <button class="dropdown-item" type="button"><app-icon name="pencil"></app-icon> Edit</button>
    <button class="dropdown-item" type="button"><app-icon name="files"></app-icon> Duplicate</button>
    <app-dropdown-item icon="trash-2" tone="Danger">Delete</app-dropdown-item>
</app-dropdown>
A reason for the disabled item
Show code
<app-dropdown icon="more-horizontal" label="Row actions">
    <app-dropdown-item icon="pencil">Edit</app-dropdown-item>
    <app-dropdown-item icon="box-seam" disabled="true" disabled-reason="Close the project first. Only a closed project can be archived.">Archive</app-dropdown-item>
    <app-dropdown-item icon="files" disabled="true">Duplicate</app-dropdown-item>
</app-dropdown>

Posting and responsive

Let a menu item post a quick change, and hide a duplicate control on wide screens where the toolbar shows it.

Move a request to tomorrow
Show code
<app-dropdown icon="more-horizontal" label="Request actions">
    <app-dropdown-item action="?handler=Snooze" confirm="Move this to tomorrow?" icon="calendar">Move to tomorrow<app-dropdown-item-value name="id" value="42" /></app-dropdown-item>
</app-dropdown>
Hidden from md up
Show code
<app-dropdown icon="more-horizontal" label="Row actions">
    <app-dropdown-item icon="pencil" hidden-from="AppDropdownItemHiddenFrom.Md">Edit</app-dropdown-item>
    <app-dropdown-item icon="files" hidden-from="AppDropdownItemHiddenFrom.Md">Duplicate</app-dropdown-item>
    <app-dropdown-item icon="trash-2" tone="Danger">Delete</app-dropdown-item>
</app-dropdown>

Grouping

Group related items under a divider or a heading, so a long menu reads in clear parts.

A divider between groups
Show code
<app-dropdown icon="more-horizontal" label="Row actions">
    <button class="dropdown-item" type="button"><app-icon name="pencil"></app-icon> Edit</button>
    <button class="dropdown-item" type="button"><app-icon name="files"></app-icon> Duplicate</button>
    <hr class="dropdown-divider" />
    <app-dropdown-item icon="trash-2" tone="Danger">Delete</app-dropdown-item>
</app-dropdown>
Group headings
Show code
<app-dropdown icon="more-horizontal" label="More actions">
    <app-dropdown-header>Workspace</app-dropdown-header>
    <app-dropdown-item>Plan overrides</app-dropdown-item>
    <hr class="dropdown-divider" />
    <app-dropdown-header>Billing</app-dropdown-header>
    <app-dropdown-item>Start a trial</app-dropdown-item>
    <app-dropdown-item>Give a free subscription</app-dropdown-item>
</app-dropdown>

Custom trigger

Use a custom trigger for an account chip or a button-style menu; the trigger replaces the default icon.

An account chip trigger
When an app-dropdown-toggle is present it replaces the icon glyph in the toggle, which switches to a reset wrapper instead of the topbar icon button, so your trigger's own styling shows through unchanged.
Show code
<app-dropdown label="Account menu">
    <app-dropdown-toggle>
        <span class="d-inline-flex align-items-center gap-2">
            <app-avatar name="Jane Doe"></app-avatar>
            Jane Doe
            <app-icon name="chevron-down" size="14"></app-icon>
        </span>
    </app-dropdown-toggle>
    <button class="dropdown-item" type="button">Account settings</button>
    <button class="dropdown-item" type="button">Sign out</button>
</app-dropdown>
Button-style trigger
Show code
<app-dropdown label="Actions">
    <app-dropdown-toggle tone="Tone.Primary" variant="FillVariant.Solid">Actions</app-dropdown-toggle>
    <button class="dropdown-item" type="button">Export</button>
    <button class="dropdown-item" type="button">Archive</button>
</app-dropdown>
Link-style trigger
Show code
<app-dropdown label="Actions">
    <app-dropdown-toggle tone="Tone.Primary" variant="FillVariant.Link">Actions</app-dropdown-toggle>
    <button class="dropdown-item" type="button">Export</button>
    <button class="dropdown-item" type="button">Archive</button>
</app-dropdown>

Rich content

Put any markup inside the menu and it renders verbatim: an identity block, a form, anything that isn't a flat action list.

An account panel
Show code
<app-dropdown icon="user" label="Account menu">
    <div class="px-3 py-2 d-flex align-items-center gap-2">
        <app-avatar name="Jane Doe"></app-avatar>
        <div>
            <div class="fw-semibold">Jane Doe</div>
            <div class="text-muted small">jane@acme.com</div>
        </div>
    </div>
    <hr class="dropdown-divider" />
    <button class="dropdown-item" type="button">Account settings</button>
    <button class="dropdown-item" type="button">Sign out</button>
</app-dropdown>
A segmented control in the menu
Rich content isn't only display: a small app-segmented turns the panel into a compact view and density picker. The dropdown keeps its open, outside-click and Escape behaviour.
Show code
<app-dropdown icon="settings" label="View options">
    <div class="px-3 py-2">
        <div class="fw-semibold mb-2">Row density</div>
        <app-segmented label="Row density" name="density" value="cozy" size="Sm" full-width="true">
            <app-segmented-option value="compact" label="Compact" />
            <app-segmented-option value="cozy" label="Cozy" />
            <app-segmented-option value="roomy" label="Roomy" />
        </app-segmented>
    </div>
</app-dropdown>

Alignment

Open the menu from the end by default, and from the start when the trigger sits at the left edge.

End and start
Show code
<app-dropdown icon="more-horizontal" label="Aligned end" align="End">…</app-dropdown>
<app-dropdown icon="more-horizontal" label="Aligned start" align="Start">…</app-dropdown>

Open motion (product-level)

Every menu-like overlay (dropdowns, popovers, the select, date and phone panels) shares one entrance animation from the theme. It is a product-level choice on the root element, not a per-component attribute. Set <html data-wui-menu-motion="drop"> to pick: drop (zoom, fade and a 6px drop out of the trigger, the default), zoom (zoom and fade only, the quietest), spring (elastic overshoot), unfold (scales open vertically like a sheet) or none (no entrance). Menus that flip upward animate from their bottom edge automatically, and everything is disabled under prefers-reduced-motion.

Every option

Every value of every prop, one cell each.

icon: four glyphs

icon="more-horizontal"
icon="settings"
icon="user"
icon="plus"

items: row kinds

<button class="dropdown-item"> (React: { label, onClick })
<app-dropdown-item icon="edit"> (React: { icon })
<app-dropdown-item image="…"> (React: { image })
<app-dropdown-item tone="danger"> (React: { tone: "danger" })
<hr class="dropdown-divider"> (React: { divider: true })
<app-dropdown-header> (React: { header })
description="…" (React: { description })
shortcut="Enter" (React: { shortcut })
disabled="true" disabled-reason="…" (React: disabled, disabledReason)
hidden-from="md" (React: hiddenFrom: "md")
href="/Components/AppButton" (React: { to })
action="?handler=Snooze" confirm="Move this to tomorrow?" (React: onClick)
no rows (React: items={[]})

ariaLabel: names the toggle

aria-label="Row actions"

align: both values

align="end" (default)
align="start"

iconSize: glyph size

icon-size="32"

toggleClassName: button-style trigger

toggle-class="btn btn-primary"

toggleVariant: neutral trigger

toggle-variant unset (default)
toggle-variant="neutral"

menuWidth: fixed widths and fit

menu-width unset (default)
menu-width="sm"
menu-width="md"
menu-width="lg"
menu-width="fit"

menuClassName: panel class

menu-class="my-menu" (adds a class to the panel; no visible change here)

linkComponent: router links

href: a link row (React: linkComponent renders to items)

searchable: long menu

searchable unset (default)
searchable="true"

searchPlaceholder: search box label

search-placeholder="Find a project"

noMatchText: empty search result

no-match-text="Nothing matches" (type in the search box to see it)

label: toggle tooltip and name

label="Row actions"

children: rich content

(content): any markup in place of rows

trigger: custom toggle

<app-dropdown-toggle> (React: trigger, replaces the icon)

open: controlled state

open unset (default)
open={true} (React only: Razor has no controlled open)

onOpenChange: open and close requests

onOpenChange (React only: Razor has no open event; no visible change)

Guidance

What to do, and what to avoid.

Use it when

  • A row or card has several secondary actions that would clutter the layout as buttons.
  • You want a consistent “⋯” affordance for overflow actions across every row.
  • The actions are related and belong under one grouped trigger.
  • A menu lists more than about ten rows and the user knows the name of the one they want.

Reach for something else when

  • There is a single icon action. → AppActionIcon
  • The action is the primary thing on the screen. → AppButton
  • You are selecting one value from a list. → AppSelect
  • You need a yes/no confirmation. → AppConfirmDialog

Put the destructive item last

Do

Overflow actions collapse into one trigger, with the destructive one marked danger and placed last.

Avoid

Delete sits first and unmarked, so it looks like every other item and is the easiest to hit by mistake.

Keep the menu short and clear

Do

A short, scannable list of clearly worded actions.

Avoid

A menu with nine items becomes a wall to read. Group or split it, or promote the common ones out.

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

more-horizontal settings user plus
end start
none neutral
none sm md lg fit
basic icons danger shortcuts divider hiddenFrom
React, generated from the controls
<AppDropdown icon="more-horizontal" ariaLabel="Row actions" items={[
    { key: 'view', label: 'View details', onClick: () => {} },
    { key: 'rename', label: 'Rename', onClick: () => {} },
    { key: 'archive', label: 'Archive', onClick: () => {} },
  ]} />
Razor, the same props
<app-dropdown icon="more-horizontal" aria-label="Row actions">…items…</app-dropdown>

21 props. The 4 most used come first.

Used on most screens 4 props

PropTypeDefaultDescription
icondefault more-horizontal string more-horizontal Name of the glyph on the toggle button. A custom trigger replaces it.
aligndefault end start | end end Which edge of the toggle the menu lines up with.
aria-labeldefault - string - Accessible name of the toggle; it wins over label.
menu-widthdefault - sm | md | lg | fit - A fixed menu width (15, 20 or 25rem; long rows wrap instead of widening the menu), or fit: no minimum, the menu is as wide as its widest row. Unset, the menu is at least 12rem wide.

Less common 17 props

PropTypeDefaultDescription
(content)default - markup - The menu items: one button for each action (an a element for navigation), or app-dropdown-item rows.
app-dropdown-itemdefault - child - A row: href (a link; otherwise a button), icon, image, tone, description, a muted second line under the label, and shortcut, the key that runs it, drawn as a key chip at the end and named in aria-keyshortcuts. Its content is the label; other attributes land on the row.
hidden-fromdefault - sm | md | lg | xl - On an app-dropdown-item: the row hides from that width up, so the overflow menu absorbs it on narrow screens. An unknown value throws.
actiondefault - string - On an app-dropdown-item: posts here when chosen, with the antiforgery token; the answer toasts like a row action (Razor only).
confirmdefault - string - With action: ask this first.
app-dropdown-item-valuedefault - slot - A hidden field the item posts (name, value).
app-dropdown-headerdefault - child - A group heading between rows. Its content is the heading text.
labeldefault Menu string Menu Tooltip and accessible name fallback for the toggle.
icon-sizedefault 20 int 20 Size of the toggle glyph in pixels.
toggle-classdefault topbar-icon-btn string topbar-icon-btn Class for the toggle button, replacing the default. Give it a button look, such as a primary button, for a button-styled trigger.
toggle-variantdefault - neutral - neutral: a custom trigger that keeps the surrounding font and colour, with a muted fill on hover and while open. Needs an app-dropdown-toggle child.
tone (app-dropdown-toggle)default Primary Primary | Success | Warning | Danger | Info | Neutral Primary On app-dropdown-toggle: draws the trigger as an app-button of this tone. Setting tone or variant replaces the plain trigger look; not with toggle-class on the dropdown.
variant (app-dropdown-toggle)default Solid Solid | Soft | Outline | Ghost | Link | Glass Solid On app-dropdown-toggle: the trigger's fill. Link draws it as a text link.
searchabledefault false bool false Puts a search box above the rows that filters them by label as the user types, for a long menu. It filters items, so it cannot be combined with children.
search-placeholderdefault Search string Search Placeholder and accessible name of the search box. Needs searchable.
no-match-textdefault No matches. string No matches. Text shown when no row matches the search. Needs searchable.
menu-classdefault - string - Extra class on the menu container, added after its own classes.

Screen reader

3 notes
  • The toggle is a button named by ariaLabel, else by label; an icon-only toggle with neither is an unnamed button, and a development warning says so.
  • The menu closes on an outside click or Escape and moves between items with the arrow keys, and a custom trigger keeps all of it.
  • An item with a shortcut names its key to assistive technology through aria-keyshortcuts; picture rows use empty alt text.

Do and avoid

2 pairs

Put the destructive item last

Do

Overflow actions collapse into one trigger, with the destructive one marked danger and placed last.

Avoid

Delete sits first and unmarked, so it looks like every other item and is the easiest to hit by mistake.

Keep the menu short and clear

Do

A short, scannable list of clearly worded actions.

Avoid

A menu with nine items becomes a wall to read. Group or split it, or promote the common ones out.