Input
Copy Input
NewA read-only field with a copy button whose icon turns into a drawn check while a small Copied tooltip pops up.
npx motionsnack add copy-inputCustomize
<CopyInput />Props
14 properties
| Property | Type | Default | Description |
|---|---|---|---|
| onCopy | (value: string) => void | - | Called with the text after it was copied. |
| copyErrorLabel | string | "Couldn't copy. Press Ctrl+C to copy the selected text." | Message when the clipboard refuses; the text is selected so the shortcut still works. |
| copiedAnnouncement | string | 'Copied to clipboard' | Screen-reader announcement after a copy. |
| id | string | generated | Id of the input. |
| className | string | '' | Extra classes on the wrapper. |
| label | string | 'Invite link' | Label above the field. Empty hides it. |
| value | string | 'https://motionsnack.com/invite/8F2K-QX' | Text shown in the field and copied by the button. |
| helperText | string | 'Anyone with the link can join your workspace.' | Small text under the field. Empty hides it. |
| buttonStyle | 'icon' | 'text' | 'icon' | Square icon button inside the right edge, or an attached text button. |
| copyLabel | string | 'Copy' | Text of the button and its accessible name. |
| copiedLabel | string | 'Copied' | Text of the tooltip and of the button once copied. |
| resetAfter | number | 1800 | How long the copied state stays. |
| height | number | 48 | Height of the field. |
| radius | number | 12 | Corner radius of the field. |
About Copy Input
Copy Input shows a link, a code or a key that visitors need to copy, such as an invite link, a coupon or an API token. Clicking the field selects the whole text, and the copy button sits either as a small icon inside the right edge or as an attached text button. On click the text goes to the clipboard, with a fallback for older browsers; the copy icon spins away into a check mark that draws itself, a Copied tooltip pops above the button and everything settles back after a delay you set. The copied state is announced to screen readers, and every word is a prop.
What's included
- Icon button or attached text button
- Copy icon that turns into a drawn check
- Copied tooltip that pops above the button
- Clipboard API with a fallback
- Click to select the whole text
- Screen reader announcement
- Light and dark look
- Type
- Animated React input component
- Library
- Components · Input
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add copy-input