Skip to content

Copy Button ​

Loading...

Copy Button: copies text to the clipboard with visual feedback.

  • Tag: <flint-copy-button>
  • Class: FlintCopyButton

Import ​

ts
import 'flint-ui'; // auto-registers all
// or
import { FlintCopyButton } from 'flint-ui';

Usage ​

html
<flint-copy-button></flint-copy-button>

Properties ​

PropertyAttributeTypeDefaultDescription
valuevaluestring''The text value to copy.
fromfromstring''An id referencing another element to copy from. - from="el" copies textContent - from="el[attr]" copies an attribute value - from="el.prop" copies a property value
disableddisabledbooleanfalseDisables the copy button.
copyLabelcopy-labelstring'Copy'Label shown in the tooltip (idle state).
successLabelsuccess-labelstring'Copied!'Label shown in the tooltip after successful copy.
errorLabelerror-labelstring'Error'Label shown in the tooltip on copy error.
feedbackDurationfeedback-durationnumber1000Duration (ms) to show feedback before returning to idle.
tooltipPlacementtooltip-placement'top' | 'right' | 'bottom' | 'left''top'Tooltip placement.

Events ​

EventDetailDescription
flint-copy—Fired after a successful copy operation.
flint-copy-error—Fired when the copy operation fails.

Slots ​

NameDescription
success-icon
error-icon
copy-icon

CSS Custom Properties ​

PropertyDefault
--flint-copy-button-size—
--flint-copy-button-icon-size—
--flint-copy-button-success-colorvar(--flint-success-color
--flint-copy-button-error-colorvar(--flint-error-color
--flint-font-family—
--flint-border-color—
--flint-border-radius-md—
--flint-surface-1—
--flint-text-color-muted—
--flint-hover-color—
--flint-text-color—
--flint-active-color—
--flint-primary-color—
--flint-border-radius-sm—
--flint-tooltip-bg—
--flint-tooltip-text-color—