On this page
@addTagHelper *, Webority.Ui.RazorIn 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.
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
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.
1 props.
Less common 1 props
| Prop | Type | Default | Description |
|---|---|---|---|
| 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.