Components

Copy Button ​

Copy a URL, token, or other value in one click. A copy icon is supplied by default and changes to a check briefly after success. The canonical pattern nests the button inside an input’s trailing slot so the action sits within the field.

Basic Usage ​

Place <pk-copy-button slot="end"> inside <pk-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.

Attributes & Properties ​

NameDescription
ariaLabel aria-labelAccessible name shown while the copy action is available.
Type string
Default Copy
copiedLabel copied-labelAccessible 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
pk-copyEmitted when text is copied successfully
pk-copy-errorEmitted when copying fails
valueToCopyType 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