Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Actions

CopyButton <pm-copy-button>

Copies text to the clipboard and confirms it (visually and to screen readers).

Full screen

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/copy-button'; </script> <pm-copy-button value="npm i @prismora/css" show-label></pm-copy-button>

Variants

Set with the variant attribute.

variant="solid"
variant="soft"
variant="outline"
variant="ghost"

Sizes

Set with the size attribute; controls keep touch-sized targets on phones.

size="xs"
size="sm"
size="md"
size="lg"

Tones

Set tone on the element, or data-tone on any ancestor to tone a whole area.

tone="accent"
tone="secondary"
tone="neutral"
tone="success"
tone="warning"
tone="danger"
tone="info"

States

Each state is one attribute.

Disabled

Attributes

AttributeTypeDefaultDescription
valuestring—Text to copy.
forstring—id of an element whose text (or value) is copied instead.
labelstringCopyAccessible name (and visible label where the component shows one).
copied-label
prop: copiedLabel
stringCopiedText shown (and announced) after copying.
variant'solid' | 'soft' | 'outline' | 'ghost'—Visual style.
size'xs' | 'sm' | 'md' | 'lg'—Size: xs, sm, md or lg (md when not set).
show-label
prop: showLabel
booleanfalseShow the text label next to the icon.
disabledboolean—Not interactive.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-copyonPmCopyAfter a successful copy.
pm-erroronPmErrorClipboard unavailable or denied.

Methods

copy()

Used in templates

Customer 360User profileArticleComing soonServer error (500)