Skip to main content
Skip to design system navigation

COPYBUTTON

Source: app/(en)/design-system/_components/CopyButton/CopyButton.client.tsx. Client component: it needs 'use client' for clipboard access and feedback state.

Props

PropTypeDefaultRequired
ProptextTypestringDefaultnoneRequiredyes
ProptypeType'button' | 'submit' | 'reset'Default'button'Requiredno
ProponClickTypeMouseEventHandlerDefaultnoneRequiredno

All other button attributes pass through. A consumer onClick runs first and can call preventDefault() to skip the copy.

Example

SOURCE

<CopyButton text="pnpm install @/design-system" />

Feedback states

StateLabelAnnouncement
StateidleLabelCOPYAnnouncementnone
StatesuccessLabelCOPIEDAnnouncementCopied to clipboard.
StatefailureLabelCOPY FAILEDAnnouncementCopy failed. Select and copy the text manually.
StateunavailableLabelCOPY UNAVAILABLEAnnouncementClipboard unavailable. Select and copy the text manually.

Success returns to idle after 1.5 seconds. Repeat clicks while a copy is pending are ignored.

Accessibility

The control keeps a 44px minimum width and height in every state. A visually hidden role="status" region announces each outcome politely.