Component
Kbd
A small key cap for keyboard shortcuts. Size it to match nearby text, group several caps into a combo, drop in icons, and use it inline in prose or inside buttons.
Sizes
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HbKbdImports } from '@herbst/ui';
@Component({
selector: 'hb-demo-kbd-sizes',
imports: [HbKbdImports],
template: `
<div class="flex flex-wrap items-center gap-3">
<hb-kbd hbSize="xs">Esc</hb-kbd>
<hb-kbd hbSize="sm">Tab</hb-kbd>
<hb-kbd hbSize="md">Enter</hb-kbd>
<hb-kbd hbSize="lg">Space</hb-kbd>
<hb-kbd hbSize="xl">Shift</hb-kbd>
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HbDemoKbdSizesComponent {}
Groups & icons
Inline & in buttons
Press βK to open the command palette, or / to focus search.
API reference
hb-kbd / [hb-kbd]
| Property | Description | Type | Default |
|---|---|---|---|
| selector | Use as hb-kbd, or as an attribute on a native <kbd> element for inline prose. | hb-kbd | [hb-kbd] | β |
| [hbSize] | Cap height and text scale. | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
| [class] | Extra classes merged over the cap styling. | ClassValue | '' |
hb-kbd-group / [hb-kbd-group]
| Property | Description | Type | Default |
|---|---|---|---|
| hb-kbd-group | Lays out several caps in a row with a small gap β for combos like β K. | component | β |