Skip to Content
Documentation
Saas UI
Get Pro
Getting started
Components
Overview

Clipboard

Used to copy text to the clipboard

SourceStorybookRecipeArk

Anatomy

import { Clipboard } from '@saas-ui/react/clipboard'
<Clipboard.Root value="...">
  <Clipboard.Button />
  <Clipboard.IconButton />
  <Clipboard.Input />
</ClipboardRoot>

Examples

Copy Button

Use the Clipboard.Button or Clipboard.IconButton components to create a copy button.

Custom labels

Use the copied prop to change the label when the text is copied.

Input

Use the Clipboard.Input component to create a copy input.

Timeout

Use the timeout prop to change the duration of the copy message.

Props

Root

PropDefaultType
timeout '3000'
number

The timeout for the copy operation

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.
defaultValue
string

The initial value to be copied to the clipboard when rendered. Use when you don't need to control the value of the clipboard.

id
string

The unique identifier of the machine.

ids
Partial<{ root: string; input: string; label: string }>

The ids of the elements in the clipboard. Useful for composition.

onStatusChange
(details: CopyStatusDetails) => void

The function to be called when the value is copied to the clipboard

onValueChange
(details: ValueChangeDetails) => void

The function to be called when the value changes

value
string

The controlled value of the clipboard

Previous

Checkbox

Next

Close Button