Skip to main content
VelinStyle v1.3.0
⌂ Home
  1. Docs
  2. Components
  3. Misc
  4. Copy

Copy 1.2.2

The <velin-copy> Web Component copies text to the clipboard and shows a short success state. Use it beside code blocks, API keys, or share links. Deutsch: Kopieren

Maturity: Documented as stable in VelinStyle 1.2.0. Design Intelligence (plan / review / agent meta) is separate and beta / foundation where noted.

When to use

When not

Basic

npm install @birdapi/velinstyle
<velin-copy value="npm install @birdapi/velinstyle" label="Copy"></velin-copy>

Alternatively set text (alias), data-source on the element, or copy from a nearby element id via data-source="#copyDemoText".

API note: <velin-copy> reads value / text (or data-source). Do not wrap a child button with data-velin-copy — that attribute pattern is not the Web Component API.

Attributes

AttributeNotes
value / textString copied on click (first match wins)
labelOptional visible label beside the icon
data-sourceCSS selector; copies textContent of the matched node

Events

Listen for velin-copied (bubbles) — detail.value contains the copied string.

document.querySelector('velin-copy').addEventListener('velin-copied', (e) => {
  console.log('Copied', e.detail.value);
});

Declarative twin: velin-copy HTML attribute — see HTML attributes.

Accessibility