StellarUI

<stellar-button-copy>

Reusable clipboard action with size, icon, tooltip labels, and copied-state delay.

Properties

Preview

Markup

Copy
<stellar-button-copy
  code="return &quot;hello&quot;"
  tooltip-label="Copied to clipboard"
>
</stellar-button-copy>

API

Complete props, events, slots, and implementation notes for the shipped copy button.

Props

PropTypeDefaultNotes
codestring''
disabledbooleanfalse
toneneutral | primary | secondary | tertiary | errorneutral
appearancesolid | outline | dash | soft | ghost | linkghost
sizexs | sm | md | lg | xlmd
shape'' | square | circlesquare
width'' | wide | full''
iconstringmdi:content-copy
delaynumber2000
tooltip-labelstringCopy code

Events

EventSourceNotes
custom eventsnonestellar-button-copy uses Datastar's built-in @clipboard(...) action and does not emit custom events.

Slots

SlotNotes
iconOptional icon override for the button face. Falls back to the icon prop or the copied check icon.
tooltipOptional tooltip override shown during the copied delay window. Falls back to tooltip-label.

Notes

  • `stellar-button-copy` is the shared clipboard control used by docs markup cards and other utility surfaces.
  • It now delegates its visible button treatment to `stellar-button` instead of carrying a separate visual button implementation.
  • It uses Datastar Pro's built-in `@clipboard(...)` action for the actual clipboard write.
  • `tooltip-label` drives the visible tooltip bubble shown during the copied delay window.
  • The button accessibility name stays a fixed `copy`.
  • `disabled` is explicit so callers can turn the control off without also clearing the clipboard payload.
  • `tone`, `appearance`, `size`, `shape`, and `width` pass through directly to the inner `stellar-button`.
  • `icon` and `tooltip` slots let callers replace the default icon and copied-state tooltip content without giving up the simple prop API.
  • `delay` is in milliseconds and clamps at zero, so callers can shorten or effectively disable the copied linger time.