Skip to content

Copy button

Copies text to the clipboard and confirms it in place, visually and for screen readers.

CSS + mian.js JSON Markdown Registry item

Copy buttons

Copy field

Installation

Everything ships in one stylesheet and one small script. There is nothing to import per component.

<link rel="stylesheet" href="https://mian.ro/dist/mian.css">
<script src="https://mian.ro/dist/mian.js" defer></script>

Prefer to own the files? /r/copy-button.json is a registry item with this component's CSS and example markup, ready to copy into your project with any tool that reads the open registry-item format.

Class reference

Class / attributeDescription
mn-copy[data-mn-copy="text"]Copies the given text.
data-mn-copy-target="#el"Copies an element’s value or text instead.
mn-copy-idle · mn-copy-doneContent shown before and after copying.
mn-copy-fieldA read-only input joined to a copy button.

Accessibility

  • “Copied to clipboard” is announced in a polite live region (override with data-mn-copied).
  • Keep a visible label or aria-label on icon-only copy buttons. Emits mn:copy with { text }.
Choose a noodle

Minimal

Flat

Pixel

Linear

Thin

Glass

Textured

Bold

Elegant

Rounded

On this page