XiodUI
HomeDocs
OverviewComponentsStyling & CustomizationChangelog

Components

  • Accordion
  • Agent Steps
  • Alert
  • Alert Dialog
  • Aspect Ratio
  • Autocomplete
  • Avatar
  • Badge
  • Breadcrumb
  • Button
  • Button Group
  • Button Split
  • Calendar
  • Card
  • Carousel
  • Checkbox
  • Circular Progress
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy To Clipboard
  • Corner Badge
  • Dashboard Grid
  • Date Picker
  • Dialog
  • Dot Matrix
  • Draggable
    Updated
  • Drawer
  • Empty
  • Field
  • Fieldset
  • File Upload
    Updated
  • Form
  • Frame
  • Gauge
  • Grid
  • Group
  • Input
  • Input Group
  • Input OTP
  • Input Payment
  • Input Phone
    Updated
  • Input Sensitive
  • Kbd
  • Kinetic Click
  • Label
  • List Box
    Updated
  • Loader
  • Marker
  • Menu
  • Menubar
  • Message
  • Meter
  • Morphic Toast
  • Navigation Menu
  • Number Field
  • Option Picker
  • Orb
  • Pagination
  • Popover
  • Preview Card
    Updated
  • Progress
  • Radio
  • Resizable
  • Ruler Picker
  • Scroll Area
  • Scroll Bar
  • Select
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Sortable
  • Switch
  • Table
  • Tabs
  • Text
  • Textarea
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Toolbar
  • Tooltip
  • Waveform
  • Wheel Picker

Loading...

Preview Skeleton

Installation Skeleton

Usage Skeleton

API Reference Skeleton

Sponsors

Support the development of XiodUI and help us build the best component library on Earth.

+++
Sponsor on GitHub

Copy To Clipboard

Previous: Context MenuNext: Corner Badge

A button that copies a value to the clipboard and confirms when it has.

Preview

Loading Preview...

Installation

bun add xiod-ui

Usage

Imports

1import { CopyToClipboard } from "xiod-ui/copy-to-clipboard";

API Reference

Detailed documentation of properties and options.

CopyToClipboard

Accepts render, plus every native <div> attribute.

PropTypeDefaultDescription
textReq
string
–

The text to copy. It is also what the field shows, unless you pass children.

buttonProps
DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
Context MenuCorner Badge
–

Props for the copy button.

children
ReactNode
–

What the field shows in place of text. The copied value is still text, or textToCopy.

copiedIcon
ReactNode
–

Replaces this icon. Accepts any node; null renders no icon. Takes precedence over IconProvider.

copiedText
string
Copied!

The confirmation shown after copying, in the toast or, without one, in the tooltip.

copyIcon
ReactNode
–

Replaces this icon. Accepts any node; null renders no icon. Takes precedence over IconProvider.

disabled
boolean
false

Whether copying is disabled.

onCopy
((value: string) => void)
–

Called with the copied value once it reaches the clipboard.

onError
((error: unknown) => void)
–

Called when there is nothing to copy or the browser refuses the copy.

showToast
boolean
true

Whether to confirm a copy with a toast anchored to the button. The toast needs an AnchoredToastProvider; without one, the tooltip confirms instead.

showTooltip
boolean
true

Whether the copy button shows a tooltip.

side
"top"|"bottom"|"left"|"right"
top

Which side of the copy button the tooltip and toast open on.

size
"lg"|"sm"|"default"
default

The size of the component.

textProps
DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
–

Props for the element that shows the text.

textToCopy
string
–

The text to copy, when it differs from text.

timeout
number
2000

How long the copied state and its toast last, in milliseconds.

tooltipText
string
Copy

The copy button's tooltip, also used as its accessible name.