On this page
@addTagHelper *, Webority.Ui.RazorIn context
Icon actions sit in a row, one per record, where a full labelled button would crowd the line.
Compact and neutral
Compact and neutral icon actions suit a card corner, where the more-actions button should stay quiet.
File mode
An icon action with a name opens the file chooser, and the chosen file posts with the form under that name.
Every option
Every value of every prop, one cell each.
icon: name or custom node
icon="trash-2": resolved by nameicon={<svg .../>}, React onlyiconVariant: 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 tooltipsize: 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)disableddisabled 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 actionhref: button or link
(default) renders <button>as: React only
as="span", React only: Razor reaches the outcome with hrefas="a", React only: Razor reaches the outcome with hrefonClick and onClickCapture: the press handlers
onClick: the page wires the pressonClickCapture, React onlyonFiles and name: the file chooser
name="photo": the file chooser posts with the formonFiles, React onlyaccept: the file types
accept="image/*"multiple: one file or several
(default)multipleclassName: extra classes (React only)
className="ms-2", React onlysubmit: 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
When a row has more than two or three actions, collapse the extras behind a single "more" trigger.
Five icons crammed in a row is a guessing game, with too many targets to scan at a glance.
Use a conventional glyph
A recognisable, conventional glyph. A trash can reads as "delete" with no thinking.
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.
20 props. The 5 most used come first.
Used on most screens 5 props
| Prop | Type | Default | Description |
|---|---|---|---|
| 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
| Prop | Type | Default | Description |
|---|---|---|---|
| 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 pairsCollapse the extra actions
When a row has more than two or three actions, collapse the extras behind a single "more" trigger.
Five icons crammed in a row is a guessing game, with too many targets to scan at a glance.
Use a conventional glyph
A recognisable, conventional glyph. A trash can reads as "delete" with no thinking.
An obscure glyph for a common action makes the user hover and hope. Stick to the conventional icon.