Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

In context

Icon actions sit in a row, one per record, where a full labelled button would crowd the line.

A row action group
Show code
<app-action-icon icon="eye" label="View" />
<app-action-icon icon="pencil" label="Edit" />
<app-action-icon icon="trash-2" label="Delete" tone="AppActionIconTone.Danger" />

Compact and neutral

Compact and neutral icon actions suit a card corner, where the more-actions button should stay quiet.

Compact and neutral on a card
Sprint 42, 6 items
Show code
<app-action-icon icon="more-horizontal" label="Actions" size="16" density="Compact" tone="AppActionIconTone.Neutral" />

File mode

An icon action with a name opens the file chooser, and the chosen file posts with the form under that name.

Attach a photo
Show code
<form method="post" enctype="multipart/form-data">
    <app-action-icon icon="camera" label="Add photo" name="photo" accept="image/*" />
</form>

Every option

Every value of every prop, one cell each.

icon: name or custom node

icon="trash-2": resolved by name
icon={<svg .../>}, React only
Razor takes an icon name only

iconVariant: the six iconsax styles

icon-variant="linear" (default)
icon-variant="outline"
icon-variant="bold"
icon-variant="bulk"
icon-variant="broken"
icon-variant="twotone"

label: the accessible name

label="Edit": the accessible name and the tooltip

size: 16, 20 (default), 24, 32

size="16"
size="20" (default)
size="24"
size="32"

tone: none (default), danger, neutral

(default)
tone="danger"
tone="neutral"

density: comfortable (default), compact

density="comfortable" (default)
density="compact"

disabled: off (default) or on

(default)
disabled
disabled tone="danger"

tooltipPlacement: auto (default), top, bottom, start, end

tooltip-placement="auto" (default)
tooltip-placement="top"
tooltip-placement="bottom"
tooltip-placement="start"
tooltip-placement="end"

shortcut: a key chip in the tooltip

shortcut="E": the key that runs the action

href: button or link

(default) renders <button>
href="/Components/AppButton" renders <a>
href + disabled: drops href, aria-disabled + role="link", leaves tab order

as: React only

as="span", React only: Razor reaches the outcome with href
React only
as="a", React only: Razor reaches the outcome with href
React only

onClick and onClickCapture: the press handlers

onClick: the page wires the press
onClickCapture, React only
React only

onFiles and name: the file chooser

name="photo": the file chooser posts with the form
onFiles, React only
React only

accept: the file types

accept="image/*"

multiple: one file or several

(default)
multiple

className: extra classes (React only)

className="ms-2", React only
React only

submit: post once files are chosen (Razor only)

submit="true"

confirm: ask first (Razor only)

confirm="Delete this photo?"
confirm-title="Delete photo"
confirm-label="Delete"
confirm-tone="danger"

Guidance

What to do, and what to avoid.

Use it when

  • A row or toolbar needs a compact action and the icon is unambiguous: edit, delete, view, more.
  • Space is tight and a labelled button would crowd the layout.
  • The action recurs on every row, so users learn the icon once.

Reach for something else when

  • The action is the primary thing on the screen. → AppButton
  • You need several actions behind one trigger. → AppDropdown
  • The meaning is not obvious from an icon alone. → a button with a visible label
  • It toggles a single on/off setting. → AppSwitch

Collapse the extra actions

Do

When a row has more than two or three actions, collapse the extras behind a single "more" trigger.

Avoid

Five icons crammed in a row is a guessing game, with too many targets to scan at a glance.

Use a conventional glyph

Do

A recognisable, conventional glyph. A trash can reads as "delete" with no thinking.

Avoid

An obscure glyph for a common action makes the user hover and hope. Stick to the conventional icon.

Reference

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

pencil trash-2 eye download more-horizontal share-2 external-link
linear outline bold bulk broken twotone
comfortable compact
auto top bottom start end
(none) danger
none danger neutral
React, generated from the controls
<AppActionIcon icon="pencil" label="Edit" onClick={fn} />
Razor, the same props
<app-action-icon icon="pencil" label="Edit" />

20 props. The 5 most used come first.

Used on most screens 5 props

PropTypeDefaultDescription
icondefault - string - The glyph, given as a semantic icon name.
labeldefault - string - The accessible name of the control. It also shows as a tooltip on hover and focus.
tonedefault - danger | neutral - danger draws a destructive tint. neutral mutes the ink and the hover surface, for an action on a card or a quiet surface.
disableddefault false bool false Turns the action off.
tooltip-placementdefault auto auto | top | bottom | start | end auto The side the tooltip prefers. Auto picks the side with the most room.

Less common 15 props

PropTypeDefaultDescription
icon-variantdefault linear linear | outline | bold | bulk | broken | twotone linear The iconsax style of a named icon.
densitydefault comfortable comfortable | compact comfortable How much room surrounds the glyph: comfortable keeps an 8px ring, compact 4px (a 16px glyph in a 24px disc).
shortcutdefault - string - The key that runs this action, such as J or E. It is drawn as a key chip in the tooltip.
hrefdefault - string - Makes the action a link to this address.
namedefault - string - Turns the button into a file chooser: a hidden file input after it opens on click, Enter and Space, and the chosen files post with the form under this name. Cannot be combined with href.
confirmdefault - string - A question to ask first, in the shared confirm dialog. The action goes ahead (a link is followed, a form is submitted) only when the person confirms. Needs no page script.
confirm-titledefault - string - The confirm dialog's heading. Needs confirm.
confirm-labeldefault Confirm string Confirm The confirm button's text. Needs confirm.
confirm-tonedefault - string - The confirm button's tone. danger draws it red, for a destructive action; leave it off for a plain confirmation. An unknown value throws. Needs confirm.
acceptdefault - string - The file types the chooser offers. File mode only.
multipledefault false bool false Allows several files. File mode only.
submitdefault false bool false Submit the enclosing form as soon as files are chosen. Needs name. Razor-only; React hands the files to onFiles.
sizedefault 20 int 20 The glyph size in px. The disc around it scales with it.
asdefault - - - Razor reaches the same outcome by setting href: it renders a button, or a link when href is set.
onClickdefault - - - A Razor page wires its own click behaviour (a form post, a client script) on the rendered button or link.

Screen reader

4 notes
  • The label is the accessible name of the control and also shows as a tooltip on hover and focus.
  • A shortcut is announced through aria-keyshortcuts; the page binds the key itself.
  • A disabled link keeps role link with aria-disabled and leaves the tab order; a disabled button uses the native disabled state.
  • In file mode the control is a button and the hidden file input is aria-hidden and outside the tab order.

Do and avoid

2 pairs

Collapse the extra actions

Do

When a row has more than two or three actions, collapse the extras behind a single "more" trigger.

Avoid

Five icons crammed in a row is a guessing game, with too many targets to scan at a glance.

Use a conventional glyph

Do

A recognisable, conventional glyph. A trash can reads as "delete" with no thinking.

Avoid

An obscure glyph for a common action makes the user hover and hope. Stick to the conventional icon.