Park UI Logo
GitHub
Components
Clipboard

Clipboard

A simple component to copy text to the clipboard

Usage

import { CheckIcon, ClipboardCopyIcon } from 'lucide-react'
import { Clipboard, FormLabel, IconButton, Input } from '~/components/ui'

export const Demo = (props: Clipboard.RootProps) => {
  return (
    <Clipboard.Root value="https://park-ui.com" {...props}>
      <Clipboard.Label asChild>
        <FormLabel>Copy this link</FormLabel>
      </Clipboard.Label>
      <Clipboard.Control>
        <Clipboard.Input asChild>
          <Input />
        </Clipboard.Input>
        <Clipboard.Trigger asChild>
          <IconButton variant="outline">
            <Clipboard.Indicator copied={<CheckIcon />}>
              <ClipboardCopyIcon />
            </Clipboard.Indicator>
          </IconButton>
        </Clipboard.Trigger>
      </Clipboard.Control>
    </Clipboard.Root>
  )
}

Installation

npx @park-ui/cli components add clipboard