Use the Copy component to allow users to copy text, data, links, coupon codes or snippets with a single click. They eliminate manual selection and reduce errors.
Preview
Primary
Secondary
Flat
Outline
Info
Success
Warning
Alert
Simply place the text inside the component you’d like to make copyable. The component comes with the above themes. You can set themes using the theme prop to change the visual appearance of your copy element.
Custom icons
The Copy component can also be created with custom icons. Use the copyIcon and copiedIcon props to create the Copy component with custom icons:
Click to copy
You can use an icon type for the Astro component, or import SVG icons for Svelte/React components. For a list of available icon types, please see the documentation of the Icon component.
Styles
The Copy component extends the Badge component, meaning you can use the component with badge-specific props, such as small and rounded to change the appearance of your elements:
Small copies
Primary
Secondary
Outline
Info
Success
Warning
Alert
Small & rounded
Primary
Secondary
Outline
Info
Success
Warning
Alert
Tooltips
You can provide additional details to your users for the component with the tooltip prop. To position the tooltip, use the tooltipPosition prop: