TidalUI

Copy button preview

Copy text with clear loading, success and retry feedback.

free · Essentials · primitive

When to use

Alternatives

Configure components.json and the @tidal-pro namespace before installing Pro components.

Installation

npx shadcn@latest add https://tidalui.com/r/copy-button.json

Import components/ui/tidal.css, components/ui/copy-button.css. Wrap installed components in tidal-scope.

Preview

Copy button component preview

Open interactive preview

Minimal example

import"./components/ui/tidal.css";
import"./components/ui/copy-button.css";
import{TidalCopyButton}from"./components/ui/copy-button";
export default()=><div className="tidal-scope"><TidalCopyButton text="Copy this"/></div>;

API and props

TidalCopyButton.clipboard
TidalClipboardAdapter | undefined

Optional clipboard value accepted by this exported component.

TidalCopyButton.disabled
boolean | undefined

Optional disabled value accepted by this exported component.

TidalCopyButton.feedbackDuration
number | undefined

Optional feedback duration value accepted by this exported component.

TidalCopyButton.getText
(() => string | Promise<string>) | undefined

Optional get text value accepted by this exported component.

TidalCopyButton.labels
Partial<TidalCopyButtonLabels> | undefined

Optional labels value accepted by this exported component.

TidalCopyButton.onCopy
(ClipboardEventHandler<HTMLButtonElement> & ((value: string) => void)) | undefined

Callback invoked when the copy interaction is proposed.

TidalCopyButton.onCopyError
((kind: TidalCopyErrorKind, error: unknown) => void) | undefined

Callback invoked when the copy error interaction is proposed.

TidalCopyButton.onStatusChange
((status: TidalCopyStatus) => void) | undefined

Callback invoked when the status change interaction is proposed.

TidalCopyButton.text
string | undefined

Optional text value accepted by this exported component.

Complete usage

Full example, stylesheet imports, API and accessibility documentation

Gotchas