--- ## CopyButton One-tap copy-to-clipboard button with built-in success feedback (the icon swaps to a check and the intent flips to success for a moment). Icon-only by default; pass `label` for a labelled variant. Forwards `variant`/`intent`/`size`/`tier` to the underlying Button, so it inherits the full button styling vocabulary. **Import:** `import { CopyButton } from '@urbicon-ui/blocks';` ### Examples ```svelte ``` ### Variants - size: 2xs, lg, md, sm, xl, xs (default: md) - state: copied, error, idle (default: idle) ### Api | Prop | Type | Required | Default | Description | | --- | --- | :---: | --- | --- | | value | `string` | yes | | The text written to the clipboard when pressed. | | ...HTMLButtonAttributes | `HTMLAttributes` | no | | HTML attributes (excluding: 'value' | 'onclick' | 'class' | 'disabled') | | ...Pick | `inherited` | no | | Properties inherited from Pick | | class | `string` | no | | Additional CSS class merged onto the underlying Button. | | copiedLabel | `string` | no | the i18n "Copied" string | Visible label shown for `timeout` ms after a successful copy. | | hideIcon | `boolean` | no | false | Hide the copy/check icon (label-only). | | label | `string` | no | | Optional visible label next to the icon. When omitted the button is icon-only. | | onCopy | `(value: string) => void` | no | | Called with `value` after it is written to the clipboard. | | onError | `(error: unknown) => void` | no | | Called with the thrown error when the clipboard write fails (permission denied, insecure context, …). | | preset | `string` | no | | Apply a named preset registered via ``. Prefer this over `class` overrides when the requested look falls outside the semantic intent palette — presets keep hover/active/dark-mode logic coherent. | | slotClasses | `Partial>` | no | | Per-slot class overrides. Slots: base | icon | label | | timeout | `number` | no | 2000 | How long the success/error state stays before reverting, in ms. `0` keeps it until the next copy. | | unstyled | `boolean` | no | | Strip all default styles; forwarded to the underlying Button. | | size | `'2xs' | 'lg' | 'md' | 'sm' | 'xl' | 'xs'` | no | md | Controls the dimensions, padding, and text size of the CopyButton. Affects the component's physical footprint. Available options: 2xs, lg, md, and 3 more. | | state | `'copied' | 'error' | 'idle'` | no | idle | Controls the visual state representation of the CopyButton to communicate status to users. Available options: copied, error, idle. | Inherited from: - Pick (external) - Omit (omit-pattern) ### Types ```ts type MintProp = | string | { name: string; config?: MintConfig & Record } | Array | Array }> ``` ```ts type SlotNames = keyof ReturnType & string ``` ```ts interface MintConfig { trigger?: 'hover' | 'click' | 'focus' | 'load'; duration?: number; delay?: number; easing?: string; disabled?: boolean; } ``` ### Slots (slotClasses keys) `base`, `icon`, `label`