Pular para o conteúdo

Clipboard

Este conteúdo não está disponível em sua língua ainda.

The Clipboard utility component allows users to copy text or code to the clipboard with a single click.
It provides visual feedback when the content is successfully copied.

  • Interactive copy button: Users can click to copy content.
  • Visual feedback: Shows a “Copied” state with icons or text.
  • Supports code or plain text: Works with <Code>, <div>, or any text container.
  • Customizable: You can style buttons, icons, or code containers as needed.
    content
Prop / SlotTypeDefaultDescription
ButtoncomponentOptionalCustomizable copy button with optional icons and text.
Code / contentHTMLElement / slotRequiredThe text or code block to be copied.
copiedbooleanfalseState to indicate if the content was successfully copied.
  • Always provide visual feedback when a copy action succeeds.
  • Ensure accessibility by labeling the copy button properly.
  • Use with scrollable or long code blocks by restricting container height.
  • Prefer inline SVG icons for consistency and fast loading.
  • Reset the copied state after a short duration to allow multiple copy actions.