Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

A strip of tools

Use a toolbar for a strip of tools over a canvas, where the active tool expands to show its label.

Click across the tools
Show code
<app-toolbar label="Canvas tools" name="tool" value="select">
    <app-toolbar-item value="select" title="Select" icon="cursor" />
    <app-toolbar-item value="draw" title="Draw" icon="pencil" />
    <app-toolbar-item value="shape" title="Shapes" icon="shield" />
</app-toolbar>

Momentary actions

Add commands beside the tools, after a divider, for actions that fire once and never stay selected.

Tools plus actions
Show code
<app-toolbar label="Canvas tools" name="tool2" value="select">
    <app-toolbar-item value="select" title="Select" icon="cursor" />
    <app-toolbar-item value="draw" title="Draw" icon="pencil" />
    <app-toolbar-item value="shape" title="Shapes" icon="shield" />
    <app-toolbar-action title="Lock canvas" icon="lock" />
    <app-toolbar-action title="Share" icon="share-2" />
</app-toolbar>

Disabled tools

Disable one tool to keep it visible but unpickable, or disable the whole strip when nothing can be picked.

One tool off, then everything off
Show code
<app-toolbar label="Partially disabled" name="tool3" value="select">
    <app-toolbar-item value="select" title="Select" icon="cursor" />
    <app-toolbar-item value="draw" title="Draw" icon="pencil" />
    <app-toolbar-item value="ai" title="AI edit" icon="stars" disabled="true" />
</app-toolbar>
<app-toolbar label="Disabled toolbar" name="tool4" value="select" disabled="true">
    <app-toolbar-item value="select" title="Select" icon="cursor" />
    <app-toolbar-item value="draw" title="Draw" icon="pencil" />
</app-toolbar>

Every option

Every value of every prop, one cell each.

items

items: five tools
items: three tools
items: with a disabled tool
items: empty strip

actions

actions: none (default)
actions: two momentary buttons

value

value="select"
value="draw"
value="shape"
value="text"
value="comment"

defaultValue

value="select" (React: defaultValue)
value="draw" (React: defaultValue)
value="shape" (React: defaultValue)
value="text" (React: defaultValue)
value="comment" (React: defaultValue)

onChange

onChange (React only): fires with the picked tool; Razor posts the pick with the form

label

label: names the toolbar for screen readers

name

name: groups the radios and posts with a form

disabled

disabled: off (default)
disabled: whole strip off

className

class: extra class on the toolbar element (React: className)

Guidance

What to do, and what to avoid.

Use it when

  • A work surface (canvas, editor, board) where the user picks the tool in hand.
  • The set is small and icon-first, with one clearly active tool.
  • Commands that belong beside the tools ride along as momentary actions.

Reach for something else when

  • You are choosing a form value, such as view mode, period or theme. → AppSegmented
  • The icons are row or record actions in a table or header. → AppActionIcon
  • You want navigation shortcuts on a marketing page. → AppFloatingDock

Reference

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

select draw shape text comment
React, generated from the controls
<AppToolbar
  label="Canvas tools"
  name="tool"
  items={items}
  value={tool}
  onChange={setTool}
/>
Razor, the same props
<app-toolbar label="Canvas tools" name="tool" value="select">
    <app-toolbar-item value="select" title="Select" icon="cursor" />
    <app-toolbar-item value="draw" title="Draw" icon="pencil" />
    <app-toolbar-item value="shape" title="Shapes" icon="shield" />
    <app-toolbar-item value="text" title="Text" icon="text" />
    <app-toolbar-item value="comment" title="Comment" icon="chat" />
    <app-toolbar-item value="ai" title="AI edit" icon="stars" />
</app-toolbar>

5 props. The 3 most used come first.

Used on most screens 3 props

PropTypeDefaultDescription
labeldefault - string - Accessible name for the toolbar.
valuedefault - string - The active tool's value (controlled).
disableddefault false bool false Disables the whole toolbar.

Less common 2 props

PropTypeDefaultDescription
(children)default - app-toolbar-item - The tools, left to right. One child element per tool.
namedefault generated string generated Field name grouping the radios, and what posts in a form. Defaults to a generated one.

Screen reader

3 notes
  • The strip has role toolbar, named by the label prop, and aria-disabled when the whole toolbar is disabled.
  • Tools are real radio inputs inside labels, so arrow keys move between them, the strip is one tab stop and screen readers announce the choice.
  • Momentary actions are buttons named by their title, and the expand and collapse motion honours reduced motion.