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 '@getufy/flint-ui'; // auto-registers all
// or
import { FlintCopyButton } from '@getufy/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.
disableddisabledbooleanfalseDisables the copy button.
copyLabelcopy-labelstring | undefined—Label shown in the tooltip (idle state). Defaults to localized "Copy". Set to empty string to hide.
successLabelsuccess-labelstring | undefined—Label shown in the tooltip after successful copy. Defaults to localized "Copied!". Set to empty string to hide.
errorLabelerror-labelstring'Error'Label shown in the tooltip on copy error.
feedbackDurationfeedback-durationnumber1000Duration (ms) to show feedback before returning to idle.
tooltipPlacementtooltip-placementPlacement'top'Tooltip placement.

Events ​

EventDetailDescription
flint-copy&#123; value: string &#125;Fired after a successful copy operation. detail: &#123; value: string &#125;
flint-copy-error&#123; reason: string &#125;Fired when the copy operation fails. detail: &#123; reason: string &#125;

CSS Parts ​

NameDescription
buttonThe button element.
copy-iconThe copy icon element.
error-iconThe error icon element.
success-iconThe success icon element.

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—