# Copy button

- **[Atoms](/components/)**

An icon button that copies a value and confirms with a check.

## When to use

- **Use for**: Next to a command, token or id people paste elsewhere.
- **Not for**: Long text. Offer a download instead.
- **Pairs with**: Command boxes, code blocks.

## Preview

copy-button.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { CopyButton } from '@/components/klarhimmel/ui/copy-button';

export default function Example() {
  return (
    <Theme theme="brand">
      <CopyButton value="npm install" label="Copy command" />
    </Theme>
  );
}
```

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/copy-button
  ```
- **Import**

  ```
  import { CopyButton } from '@/components/klarhimmel/ui/copy-button';
  ```

- **Files**: copy-button.tsx, in components/klarhimmel/ui/. With it: theme, utils. npm: lucide-react.
- **Render in**: Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

## Props

- **value**: Required. The text copied to the clipboard.
- **label**: Accessible name of the button.
- **copiedLabel**
- **className**: Extra classes, merged after the component's own.

## Accessibility

- Enter / Space · Copies and shows a check

[Accessibility](/get-started/accessibility)

[Previous](/components/text-link)

[Next](/components/input)
