A wider screen, please

This page features interactive demos and side-by-side code samples that need at least 340 pixels of horizontal space. Please widen your browser window, or rotate your device, to continue.

Morpheus v0.1.0
v0.1.0

Kbd#

Component <neo-kbd> is a small inline keyboard-key indicator: a monospaced glyph in a subtle chip with a thin border and a 1px inset bottom shadow that suggests depth. Sized off the surrounding font so it nests cleanly inside button labels, trailing input slots, and prose. Compose multi-key shortcuts with <neo-kbd-group>, an inline-flex container with a small gap.

Default
Aliases
Variants and sizes
Combinations
Inside buttons
Inside an input group
Shortcut reference
Deactivate Rename Duplicate
Delete
New state Toggle autoplay
Esc Tab Space
HTML CSS

The selected state's markup and its scoped CSS. The CSS is wrapped in <style>@scope { ... }</style> and applies to the preview only. Edits change the preview above, applied live while Sync is on, or when you click Patch or Replace. Patch morphs the preview; Replace swaps it outright.

Replace Patch

Signals

Datastar signals declared in the selected state's markup. Change a value to drive the preview, applied live while Sync is on, or when you click Patch.

Patch

Reference#

Attributes #

NameTypeDefaultDescription
keystring observednoneRender the platform-correct glyph for a single key instead of slotted content (mod renders ⌘ on Apple, Ctrl elsewhere; enter → ↩ / Enter). One key per chip; compose a shortcut from several in a <neo-kbd-group>; bind it with <neo-keys>.
variant"outline"noneVisual style. Omit for the default subtle chip.
size"sm"noneCompact size for dense rows. Omit for the default size.

Slots #

NameDescription
defaultGlyph or short word. Ignored when key is set.

CSS variables #

NameDefaultDescription
--neo-kbd-padding-y0.125remVertical padding.
--neo-kbd-padding-x0.4remHorizontal padding.
--neo-kbd-radius0.3remCorner radius.
--neo-kbd-font-size0.7emGlyph font size, relative to surrounding text.
--neo-kbd-font-weight500Glyph font weight.
--neo-kbd-min-width1.5emMinimum chip width, so single glyphs stay square.
--neo-kbd-colorcolor-mix(in srgb, currentColor 70%, transparent)Glyph color. Derived from currentColor so a chip stays legible in a colored container.
--neo-kbd-bgcolor-mix(in srgb, currentColor 5%, transparent)Chip background.
--neo-kbd-border-colorcolor-mix(in srgb, currentColor 18%, transparent)Border color.
--neo-kbd-shadowinset 0 -1px 0 0 color-mix(in srgb, currentColor 14%, transparent)Inset bottom shadow suggesting key depth.

Examples#

Platform-aware shortcuts#

Pass a key token instead of literal content and the chip renders the right glyph per OS.

A <neo-kbd> is one key; compose a shortcut from several inside a <neo-kbd-group>.

The glyph fills in after the bundle loads (you may see a brief flash on this static site). In a templ server, pass KbdOpts.UserAgent (r.UserAgent()) to pre-render it for the requesting OS; the client then reconciles.

Aliases#

key accepts convenience aliases (esc, space, up/down/left/right, del, plus, comma) that resolve to the canonical glyph (esc → ⎋ / Esc).

Variants and sizes#

variant="outline" drops the fill and shadow for a flatter look; size="sm" is a compact variant for dense rows like menu items or table cells.

Combinations#

Compose multi-key combinations with <neo-kbd-group>. The first row relies on the gap alone; the second slips literal "+" text between keys.

K P Ctrl +Shift +P

Inside buttons#

The kbd inherits the host font size and aligns to baseline, so it drops in next to a button label with no extra wrapper.

Search K Save⌘S Open command palette

Inside an input group#

Paired with <neo-input-group> the kbd makes a clean trailing shortcut hint, the command-palette pattern most editors use for global search.

K

Shortcut reference#

Each row pairs an action label with its shortcut; the kbd's monospaced font and consistent min-width keep the column aligned with no extra layout code.

Open command palette K
Quick switcher P
Save S

The kbd sits on the text baseline, so it does not push surrounding lines apart, handy for shortcuts described in flowing copy: pressEscto dismiss, or /to focus this very page's search.

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator