Components

Copy Button ​

Copy a URL, token, or other value in one click. The canonical pattern nests the button inside an input’s trailing slot so the action sits within the field.

Basic Usage ​

Place <CopyButton slot="end"> inside <Input> (or another control with an end adornment). Long values stay in the field’s remaining width instead of painting under the button.

Variants ​

In-control copy uses a compact glyph treatment. Standalone buttons still accept the usual button variants for toolbars and other controls outside a field.

API ​

Slots ​

NameDescription
iconCustom copy icon. The component supplies a copy icon by default.

Props ​

NameDescription
ariaLabelAccessible name shown while the copy action is available.
Type string
Default Copy
copiedLabelAccessible name shown briefly after copying succeeds.
Type string
Default Copied
disabledType boolean
Default false
fromElement id to copy from — from="el[attr]" or from="el.value". Takes precedence over value when set.
Type string
valueType string
variantType PkButtonVariant
Default transparent

Events ​

NameDescription
onPkCopyEmitted when text is copied successfully
onPkCopyErrorEmitted when copying fails
onValueToCopyType PkCopyEvent

CSS Custom Properties ​

NameDescription
--pk-copy-button-backgroundTrigger background override.
--pk-copy-button-border-colorTrigger border colour override.
--pk-copy-button-colorTrigger foreground colour override.
--pk-copy-button-hover-backgroundTrigger hover background override.
--pk-copy-button-hover-border-colorTrigger hover border colour override.
--pk-copy-button-hover-colorTrigger hover foreground colour override.
--pk-copy-button-radiusTrigger corner radius override.

CSS Parts ​

NameDescriptionCSS selector
buttonTrigger button::part(button)
copy-iconCopy icon shown before copying::part(copy-icon)
success-iconSuccess icon shown after copying::part(success-icon)

Dependencies ​

This component registers the following elements when it loads.

NameDescription
pk-button—
Edit this page
Last updated: Oct 7, 2026, 11:30 AM