Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

In a sentence

Use a key chip inside a sentence, so a shortcut in help text reads as part of the line.

Helper text under a field

Press Esc to close, Ctrl K to search.

Show code
<app-input label="Search"></app-input>
<p>Press <app-kbd>esc</app-kbd> to close, <app-kbd>Ctrl K</app-kbd> to search.</p>

Key names

Write one key, a key name such as esc or enter, or a few words such as Ctrl K.

Single keys and names

A Esc Ctrl K

Show code
<p><app-kbd>A</app-kbd> <app-kbd>esc</app-kbd> <app-kbd>Ctrl K</app-kbd></p>

Every option

Every value of every prop, one cell each.

children

"a" as the tag text (React: children, shows A)
A
"esc" as the tag text (React: children, shows Esc)
Esc
"enter" as the tag text (React: children, shows Enter)
Enter
"slash" as the tag text (React: children, shows /)
/
"Ctrl K" as the tag text (React: children, kept as written)
Ctrl K

className

class="" (default; React: className)
K
class="opacity-50" (React: className)
K

Guidance

What to do, and what to avoid.

Use it when

  • Naming a key in help text, in a field's helper text or in an empty state.
  • A legend or a guide that lists keys.

Reach for something else when

  • Showing the key of a button or menu row. → the shortcut prop
  • Listing every shortcut on a screen. → AppShortcutLegend

Reference

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

K
React, generated from the controls
<AppKbd>k</AppKbd>
Razor, the same props
<app-kbd>k</app-kbd>

1 props.

Less common 1 props

PropTypeDefaultDescription
contentdefault - string - The key, as the tag's text. One character is upper-cased, esc / enter / slash become Esc / Enter /, longer text is kept.

Screen reader

2 notes
  • It renders a kbd element whose text is part of the sentence, so assistive tech reads the key.
  • It only labels a key; to bind a key, put the shortcut prop on the control instead.