Get started
Forms
- Label
- Icon label
- Field
- Form
- Frontmatter form
- Questionnaire
- Input
- Input group
- Input OTP
- Password input
- Password strength
- Code input
- Number field
- Tag input
- Textarea
- Checkbox
- Radio group
- Language toggle group
- Emoji appearance toggle group
- Emoji picker
- Avatar picker
- AI provider picker
- Select
- Native select
- Combobox
- Language combobox
- Slider
- Calendar
- Switch
Display
- Alert
- Avatar
- Badge
- Card
- AI provider card
- Model info card
- Model list
- Empty
- Item
- Tree item
- File tree
- Icon media
- File type icon
- Font preview
- Image preview
- Kbd
- Table
- Data table
- Data table column header
- Chart
- Code Block
- Code card
- Markdown view
- Attachment
- Bubble
- Marker
- Message
- Chat message
- Chat suggestion item
- Message scroller
- Trace
- Progress
- Spinner
- Sonner
- Toast
- Unsaved changes toolbar
- Unsaved indicator
- Status indicator
- Permission card
- Separator
- Skeleton
- Animated grid pattern
- Meteors
Layout
Installation#
bash
pnpm dlx shadcn@latest add @zui/kbdThe CLI writes components/ui/kbd.tsx and installs Text,
Icon and Utils.
Usage#
tsx
import { Kbd, KbdGroup } from '@/components/ui/kbd';
import { Text } from '@/components/ui/text';tsx
<KbdGroup>
<Kbd>
<Text>Ctrl</Text>
</Kbd>
<Kbd>
<Text>B</Text>
</Kbd>
</KbdGroup>API reference#
Kbd#
Takes every prop of React Native's View. Its label is a Text child, which takes the cap's small muted text,
and an Icon child is drawn at 12px. A Kbd is as wide as its label.
KbdGroup#
Takes every prop of React Native's View, and lays the keys inside it out in a row.
Differences from upstream#
- Upstream's Kbd is an inline
<kbd>that sits inside a line of text. React Native cannot lay a view out inside a Text on every platform, so put a Kbd beside its sentence in a row, as the demo does. - Upstream sizes the key to its content with
w-fit, which neither engine draws. The native Kbd keeps to the width of its label by not stretching in its parent. - Inside a tooltip, upstream draws the key in the tooltip's colours. The native Kbd keeps its own colours.