Skip to content
Page

Kbd

Native keyboard shortcut token.

Open search⌘K
import { Kbd } from "@pelagornis/page/components";

The preview above renders this file. Copy it into src/components/ to start from it.

src/components/KbdExample.tsx
import { Kbd, Stack, Text } from "@pelagornis/page/components";
export default function KbdDemo() {
return (
<Stack direction="row" gap="sizeXSmall" align="center">
<Text variant="bodySm" className="text-refineui-alias-foreground-secondary">
Open search
</Text>
<Kbd>⌘</Kbd>
<Kbd>K</Kbd>
</Stack>
);
}

Kbd can be written straight in an .mdx page. Import it below the frontmatter. It renders on the server, so no client directive is needed.

src/content/docs/example.mdx
---
title: Example
---
import { Kbd } from "@pelagornis/page/components";
<span>Open search with <Kbd>⌘</Kbd> <Kbd>K</Kbd></span>

pageMarkdoc() registers a kbd tag for this component. Add the preset once in markdoc.config.mjs (see Use in Markdoc), then write the tag in any .mdoc page.

src/content/docs/example.mdoc
Open search with {% kbd %}⌘{% /kbd %} {% kbd %}K{% /kbd %}

Attributes use the same names and values as the React props.

Values the component accepts for each variant prop.

Parts of the component and the data-refineui role each one renders.

PartRole
rootkbd

States the component styles. Component states are exposed as data attributes.

Keys the component handles when it has focus.