# Command Button

A button with its shortcut drawn as keycaps that sink as you press the real keys.

Install with `npm`:

```bash
npx shadcn@latest add https://kokonutui.com/r/command-button.json
```

### Installation

Command Button is a free, open-source React component in the Kokonut UI [Buttons collection](/content/docs/buttons/index.html). Add it with the shadcn CLI, which copies the source into `components/kokonutui/command-button.tsx`, so the code is yours to change.

```bash
npx shadcn@latest add @kokonutui/command-button
```

### Usage

```javascript
import CommandButton from "@/components/kokonutui/command-button";

export default function Example() {
  return <CommandButton global={false} />;
}
```

### Props

- `children`  
  - Type: `ReactNode`  
  - Default: `"Search"`

- `shortcut`  
  - Type: `string`  
  - Default: `"mod+k"`  
  The shortcut, as `+`-joined parts: `mod` (⌘ on Mac, Ctrl elsewhere), `ctrl`, `alt`, `shift` and one key, e.g. `"mod+k"`, `"shift+n"`, `"c"`.

- `global`  
  - Type: `boolean`  
  - Default: `true`  
  Listen for the shortcut on the whole page. Shortcuts without `mod`, `ctrl` or `alt` are ignored while typing in a field.

Also takes every prop of `ComponentProps<"button">`.

### Dependencies

| Needs | Version | Comes from |
| --- | --- | --- |
| `cn` from `lib/utils.ts` |  | shadcn init |
| React | `19` | Your app |
| Tailwind CSS | `4` | Your app |

No provider, font or global CSS to set up: the file works as soon as it lands.
