mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-22 20:25:44 +00:00
* feat: add field.tsx and update blocks * feat: add input group * feat: implement button group * fix * fix * wip * fix: button group * feat: update field * fix * feat * feat: cooked * fix * chore: build registry * feat: add kbd component * chore: update input group demo * feat: update kbd component * feat: add empty * feat: add spinner * refactor: input group * feat: blocks * fix * fix: app sidebar * feat: add label to app sidebar * fix * fix * fix * fix * fix * feat * feat * fix * docs: button group * feat: add docs * docs: kbd * docs: empty * fix * docs * docs * feat: add sink link * fix * fix * docs * feat: add new page * fix * fix * fix * fix * fix * fix * feat: add registration form * fix: chat settings * fix * fix preview * fix examples * feat: add changelog * fix * fix * fix * fix * fix * feat(www): add t3 versions * chore: build registry * fix * fix * fix * feat: inline code examples for llm * fix * feat: home * fix * fix * fix * fix * fix * chore: changelog * fix * fix * fix * fix: callout * fix
105 lines
1.8 KiB
Plaintext
105 lines
1.8 KiB
Plaintext
---
|
|
title: Kbd
|
|
description: Used to display textual user input from keyboard.
|
|
component: true
|
|
---
|
|
|
|
<ComponentPreview name="kbd-demo" />
|
|
|
|
## Installation
|
|
|
|
<CodeTabs>
|
|
|
|
<TabsList>
|
|
<TabsTrigger value="cli">CLI</TabsTrigger>
|
|
<TabsTrigger value="manual">Manual</TabsTrigger>
|
|
</TabsList>
|
|
<TabsContent value="cli">
|
|
|
|
```bash
|
|
npx shadcn@latest add kbd
|
|
```
|
|
|
|
</TabsContent>
|
|
|
|
<TabsContent value="manual">
|
|
|
|
<Steps>
|
|
|
|
<Step>Copy and paste the following code into your project.</Step>
|
|
|
|
<ComponentSource name="kbd" title="components/ui/kbd.tsx" />
|
|
|
|
<Step>Update the import paths to match your project setup.</Step>
|
|
|
|
</Steps>
|
|
|
|
</TabsContent>
|
|
|
|
</CodeTabs>
|
|
|
|
## Usage
|
|
|
|
```tsx
|
|
import { Kbd } from "@/components/ui/kbd"
|
|
```
|
|
|
|
```tsx
|
|
<Kbd>Ctrl</Kbd>
|
|
```
|
|
|
|
## Examples
|
|
|
|
### Group
|
|
|
|
Use the `KbdGroup` component to group keyboard keys together.
|
|
|
|
<ComponentPreview name="kbd-group" />
|
|
|
|
### Button
|
|
|
|
Use the `Kbd` component inside a `Button` component to display a keyboard key inside a button.
|
|
|
|
<ComponentPreview name="kbd-button" />
|
|
|
|
### Tooltip
|
|
|
|
You can use the `Kbd` component inside a `Tooltip` component to display a tooltip with a keyboard key.
|
|
|
|
<ComponentPreview name="kbd-tooltip" />
|
|
|
|
### Input Group
|
|
|
|
You can use the `Kbd` component inside a `InputGroupAddon` component to display a keyboard key inside an input group.
|
|
|
|
<ComponentPreview name="kbd-input-group" />
|
|
|
|
## API Reference
|
|
|
|
### Kbd
|
|
|
|
Use the `Kbd` component to display a keyboard key.
|
|
|
|
| Prop | Type | Default |
|
|
| ----------- | -------- | ------- |
|
|
| `className` | `string` | `` |
|
|
|
|
```tsx
|
|
<Kbd>Ctrl</Kbd>
|
|
```
|
|
|
|
### KbdGroup
|
|
|
|
Use the `KbdGroup` component to group `Kbd` components together.
|
|
|
|
| Prop | Type | Default |
|
|
| ----------- | -------- | ------- |
|
|
| `className` | `string` | `` |
|
|
|
|
```tsx
|
|
<KbdGroup>
|
|
<Kbd>Ctrl</Kbd>
|
|
<Kbd>B</Kbd>
|
|
</KbdGroup>
|
|
```
|