Skip to main content
Mantı UI logoMantı UIv0.12.1
Studio

Clipboard

Pass the text to copy as value. timeout controls how long the copied state remains visible.

import { Clipboard } from '@manti-ui/react';

export default function ClipboardBasic() {
  return (
    <div className="w-full max-w-[calc(var(--manti-space-16)*6)]">
      <Clipboard
        value="npm install @manti-ui/react"
        label="Install command"
        variant="primary"
      />
    </div>
  );
}

API

PropTypeDefaultDescription
useClipboard(options: UseClipboardOptions) => UseClipboardReturnHeadless copied state and copy action for product-owned buttons and Web Share fallbacks.
valuestringThe value to copy to the clipboard.
labelReactNodeOptional label rendered above the field.
variantMantiVariant'primary'Variant of the copied indicator.
timeoutnumberHow long the copied state lasts, in milliseconds.

Styling

Anatomy

PartSelectorDescription
root[data-scope="clipboard"][data-part="root"]The wrapper around the label and control.
label[data-scope="clipboard"][data-part="label"]The label element above the field.
control[data-scope="clipboard"][data-part="control"]The row holding the input and copy button.
input[data-scope="clipboard"][data-part="input"]The read-only input showing the value.
trigger[data-scope="clipboard"][data-part="trigger"]The button that copies the value.
indicator[data-scope="clipboard"][data-part="indicator"]The icon that swaps between copy and copied states.

Tokens

TokenControls
--manti-clipboard-heightheight
--manti-clipboard-radiusradius
--manti-clipboard-padding-xpadding x
--manti-clipboard-gapgap
--manti-clipboard-font-sizefont size
--manti-clipboard-trigger-widthtrigger width

Last updated

Built end-to-end with Manti UI components and design tokens. Manti UI is a framework-agnostic design system on Zag.js.

GitHub