Typography
Code & Kbd
Inline code and keyboard keys.
import { Code, Kbd } from '@reactloom/ui';Examples
Inline code and shortcuts
Run pnpm add @reactloom/ui to install.
Open the command menu with ⌘ K or Ctrl K.
import { Code, Kbd, Stack, Text } from '@reactloom/ui';
export default function Example() {
return (
<Stack gap="2">
<Text>
Run <Code>pnpm add @reactloom/ui</Code> to install.
</Text>
<Text>
Open the command menu with <Kbd>⌘</Kbd> <Kbd>K</Kbd> or <Kbd>Ctrl</Kbd> <Kbd>K</Kbd>.
</Text>
</Stack>
);
}API reference
| Prop | Type | Default |
|---|---|---|
…Render <code> and <kbd>. | HTMLAttributes | — |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
Code
Theme tokens it reads
--pl-color-bg-subtle --pl-color-fg-default --pl-radius-sm
Kbd
Theme tokens it reads
--pl-color-bg-surface --pl-color-border-strong --pl-color-fg-default --pl-radius-sm
Accessibility
- Spell out shortcuts in text too for screen-reader users when they matter.
Usage guidelines
Do
- Use Code for identifiers, file names and short snippets inside a sentence.
- Use Kbd for each key of a shortcut: Ctrl + K is two Kbd elements.
- Show the platform’s modifier (⌘ on Apple devices, Ctrl elsewhere) when you know it.
Don’t
- Don’t use Code for multi-line examples — use a code block.
- Don’t use Kbd for anything that is not a key the user presses.