Copy Button

Click-to-copy button with clipboard icon and visual feedback. Supports inline, input field, sizes, and inset variants.

This component requires softui.js for interactive behavior.

Default

npm install softui-css
https://softui-css.netlify.app
sk-1234-abcd-5678-efgh-9012
<div class="sui-copy">
  <span class="sui-copy-text">npm install softui-css</span>
  <button class="sui-copy-btn" data-sui-copy>
    <svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>
  </button>
</div>

<!-- Click the button — icon swaps to checkmark for 1.5s -->
<!-- Text is auto-read from .sui-copy-text sibling -->

Inline

sk-1234-abcd-5678
Invite code: SOFTUI2026
<!-- Inline — just the icon, pass text via data-sui-copy -->
<code>sk-1234-abcd-5678</code>
<button class="sui-copy-inline" data-sui-copy="sk-1234-abcd-5678">
  <svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>
</button>

<!-- data-sui-copy="text" copies that exact string -->
<!-- Without data-sui-copy value, reads from .sui-copy-text sibling -->

With Input

<div class="sui-copy-input">
  <input type="text" class="sui-input" value="https://softui-css.netlify.app" readonly>
  <button class="sui-copy-btn" data-sui-copy>
    <svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>
  </button>
</div>

<!-- Auto-reads value from the .sui-input sibling -->

Sizes

Small
npm install softui-css
Default
npm install softui-css
Large
npm install softui-css
<!-- Small -->
<div class="sui-copy sui-copy-sm">
  <span class="sui-copy-text">npm install softui-css</span>
  <button class="sui-copy-btn" data-sui-copy>
    <svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>
  </button>
</div>

<!-- Default -->
<div class="sui-copy">
  <span class="sui-copy-text">npm install softui-css</span>
  <button class="sui-copy-btn" data-sui-copy>
    <svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>
  </button>
</div>

<!-- Large -->
<div class="sui-copy sui-copy-lg">
  <span class="sui-copy-text">npm install softui-css</span>
  <button class="sui-copy-btn" data-sui-copy>
    <svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>
  </button>
</div>

Inset

npm install softui-css
sk-1234-abcd-5678-efgh-9012
<div class="sui-copy sui-copy-inset">
  <span class="sui-copy-text">npm install softui-css</span>
  <button class="sui-copy-btn" data-sui-copy>
    <svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>
  </button>
</div>

Delete this item?

This action cannot be undone. This will permanently delete the item and remove all associated data.