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

EscTabEnterSpaceShift
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

⌘KCtrl+Alt+Del⌘

Inline & in buttons

Press ⌘K to open the command palette, or / to focus search.

API reference

hb-kbd / [hb-kbd]

PropertyDescriptionTypeDefault
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]

PropertyDescriptionTypeDefault
hb-kbd-group Lays out several caps in a row with a small gap β€” for combos like ⌘ K. component β€”