# Clipboard

Copy-to-clipboard button with success feedback



<ComponentPreview base="opentui" name="clipboard-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/opentui-clipboard
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="opentui" name="clipboard" title="components/ui/clipboard.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { Clipboard } from "@/components/ui/clipboard";
```

```tsx
<Clipboard value="npm install termcn" label="Install command" />
```

API Reference [#api-reference]

Clipboard [#clipboard]

| Prop             | Type     | Default     |
| ---------------- | -------- | ----------- |
| `value`          | `string` | `required`  |
| `label`          | `string` | -           |
| `successMessage` | `string` | `"Copied!"` |
| `timeout`        | `number` | `2000`      |
