Stylish Kbd
A keyboard-key indicator (kbd) showing a single shortcut label, in the style of shadcn/ui and Chakra UI's Kbd component.
Renders text centered inside a keycap-like container: a filled, outlined rounded box with the label offset 1 dp downward, mimicking a physical key whose face sits slightly above its bottom edge. Use it to document keyboard shortcuts next to their actions, e.g. StylishKbd("Ctrl") + StylishKbd("K").
The component is display-only and carries no interaction semantics.
Testing
The root carries the default test tag stylish_kbd for UI tests. Callers can override it by passing their own Modifier.testTag(...) in modifier.
Parameters
The key label (e.g. "Ctrl", "⇧", "F2").
Modifier applied to the root Box.
Fill color of the keycap. Defaults to MaterialTheme.colorScheme.surfaceContainerHigh.
Color of text. Defaults to MaterialTheme.colorScheme.onSurfaceVariant.
Typography for text. Defaults to MaterialTheme.typography.labelMedium.
Corner shape of the keycap. Defaults to a 6 dp RoundedCornerShape.
Inner padding around text. Defaults to 6 dp horizontal, 2 dp vertical.