OverviewInstallationMigrating to 1.0Themes and layersKanok designCustomizingIconsForms and validationFrameworksUsing with AIButtonText inputText areaNumber inputSearchSelectDropdownComboboxMulti-selectCheckboxRadio buttonToggleDate pickerTime pickerSliderFile uploaderModalSide panelTearsheetNotificationToastTooltipDefinition tooltipPopoverToggletipMenuData tableStructured listPaginationContained listTree viewTabsBreadcrumbLinkPagination navContent switcherAccordionProgress indicatorUI shellTagTileCardProduct cardCode snippetCopy buttonUser avatarTruncated textListLoadingInline loadingProgress barSkeletonBadge indicatorStatus indicatorGridHeadingLayerAction setPage headerBig numberEdit in placeIntroductionText inputText areaNumber inputSearchSelectDropdownComboboxMulti-selectCheckboxRadio buttonToggleDate pickerTime pickerSliderFile uploaderTabsPagination navContent switcherTooltipDefinition tooltipPopoverMenuAccordionProgress indicatorUI shellModalSide panelTearsheetNotificationToastData tableStructured listPaginationTree viewCode snippetCopy buttonTruncated textLoadingTagCardProduct cardEdit in place
Copy button
A copy button puts a value on the clipboard: a request number, a link, an API key. It is Carbon's 40px icon button: its tooltip names it ("Copy to clipboard"), and after a copy the tooltip says "Copied!" for two seconds.
npmshadcn · Web componentshadcn · React + TailwindManualnpminstall@purpurabog/uinpxshadcn@4add@kanok-ui/copy-buttonnpxshadcn@4add@kanok-ui/tw-copy-button# Web component# 1. Install the dependenciesnpminstalllit@^3.3.0# 2. Copy each file's "content" from# https://cdn.jsdelivr.net/npm/@purpurabog/ui@2.3.0/registry/copy-button.json# to its target:# components/ui/primitives/copy-button/copy-button.ts# 3. Do the same for the items it needs (registry/<name>.json):# shared-align, shared-element, shared-events, shared-field, shared-localize, tooltip, tokens# React + Tailwind# 1. Install the dependenciesnpminstall@purpurabog/ui@^2.3.0# 2. Copy each file's "content" from# https://cdn.jsdelivr.net/npm/@purpurabog/ui@2.3.0/registry/tw-copy-button.json# to its target:# components/ui/react-tw/copy-button.tsx# 3. Do the same for the items it needs (registry/<name>.json):# core-position, tw-i18n, tw-theme, tw-tooltip, tw-utils
npm gives you every component from the package. shadcn copies the source into your app instead: a copy pinned to this version that you can change. The shadcn commands need the @kanok-ui registry in your components.json once, see Installation.
label is the tooltip at rest and the button's accessible name (default "Copy to clipboard", in the page's language). feedback is the tooltip after a copy (default "Copied!"). Say what gets copied when there are several buttons on the screen.
feedback-timeout (feedbackTimeout in React) is how long the feedback shows, in ms (2000 by default). Pressing again starts the time over.
HTMLReactReact + Tailwind<divstyle="display: flex; flex-wrap: wrap; gap: 16px; align-items: center">
<ui-copy-buttontext="RQ-2026-00123"feedback-timeout="1000"label="Copy (1 second feedback)"></ui-copy-button>
<ui-copy-buttontext="RQ-2026-00123"feedback-timeout="5000"label="Copy (5 second feedback)"></ui-copy-button>
</div><UiCopyButtontext="RQ-2026-00123"feedbackTimeout={1000} label="Copy (1 second feedback)" />
<UiCopyButtontext="RQ-2026-00123"feedbackTimeout={5000} label="Copy (5 second feedback)" /><CopyButtontext="RQ-2026-00123"feedbackTimeout={1000} label="Copy (1 second feedback)" />
<CopyButtontext="RQ-2026-00123"feedbackTimeout={5000} label="Copy (5 second feedback)" />
Tooltip side
placement puts the tooltip on a side: top, bottom (the default), left, right, each with -start or -end. align is Carbon's name for the same attribute. Near the edge of the screen, the tooltip flips to the side with room.
Before it copies, the button fires ui-copy with detail.text. Call preventDefault() to put something else on the clipboard yourself; the feedback still shows. In React + Tailwind, onCopy gets the text; return false to copy it yourself. showFeedback() on the element shows the feedback at any time, for example after another control copied the value.
Hides the label tooltip (the feedback stays for its time)
Accessibility
The tooltip text is the button's accessible name, so the icon needs no other label. Give each button its own label when there are several ("Copy contract number", "Copy tax ID").
After a copy, a polite live region (role="status") says the feedback once, so screen reader users hear "Copied!" too.
Keep the copied value visible next to the button. The clipboard can't be seen, and users want to check what they took.