Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

CopyToClipboard

The CopyToClipboard component renders a compact copy control with tooltip feedback. Use it beside values such as IDs, URLs, and API keys.

Import

Inside a Payload Admin Panel Custom Component:

1
import { CopyToClipboard } from '@payloadcms/ui'

You can also import the component directly:

1
import { CopyToClipboard } from '@payloadcms/ui/elements/CopyToClipboard'

Basic usage

Loading component example…

The control is not rendered when value is empty. Provide surrounding text so users understand what will be copied.

Accessibility

  • Place the control beside a visible representation of the value being copied.
  • Use concise tooltip messages that identify the action and confirm success.
  • Do not place sensitive values in the clipboard without an explicit user action.

Common props

These are the props most commonly used with this component. See its exported types in @payloadcms/ui for the complete list.

Prop

Type

Default

Description

value

string

—

Value written to the clipboard.

defaultMessage

string

Localized copy label

Tooltip shown before the value is copied.

successMessage

string

Localized copied label

Tooltip shown after a successful copy.

Was this page helpful?

Next

DatePicker