UI Toolbox logoUI Toolbox

Kbd

A Kbd shows a keyboard shortcut as key caps. Use it in a help text, a tooltip, a menu or a tutorial. It only shows the keys; it does not listen for them.

Three shortcuts as key caps: Ctrl + K, Ctrl + Shift + S and F5

<ui:Label text="Find a command" />
<tb:Kbd keys="Ctrl+K" />
row.Add(new Kbd("Ctrl+Shift+S"));
Member Description
Keys (keys) The keys with "+" between them, such as "Ctrl+Shift+S" or "F5". Each key shows as one cap. Spaces around a key are removed.
Separator (separator) The text between two caps (default "+"). Use "then" for a sequence of keys. An empty text shows no separator.

Tips:

Styling

Class Element
tb-kbd The row of caps.
tb-kbd__key One key cap: a border that is 2 px at the bottom, a radius of 4 px, --tb-color-surface-alt and bold small text. It shares these rules with the value of a KeyBindingField.
tb-kbd__separator The text between two caps, in --tb-color-text-muted.
.tb-kbd__key { background-color: var(--tb-color-accent); color: var(--tb-color-accent-text); border-color: var(--tb-color-accent); }