CopyButton

Copy a value: a read-only pill field, a copy circle, or inline text that copies itself.

View source
import { CopyButton } from "@logicplanes/kaeso-ui";

Props

  • children
    ReactNode

    What a field or inline text shows, when it differs from the copied text, such as a redacted form; the value is still what is copied.

  • display
    "inline" | "icon" | "field" = icon

    A circle (icon), a read-only pill field (field), or mono text inside a sentence or a row (inline).

  • label
    string

    What is being copied, for the accessible name and the tooltip: "Copy key". Defaults to "Copy" in the provider's language.

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

    Called with the copied text.

  • size
    "md" | "xs" | "sm" | "lg" | "xl" = sm

    The circle's height, or a field's: 32px (sm) by default.

  • value
    string

    The text that is copied.

  • variant
    "secondary" | "ghost" | "quiet" = ghost

    A filled circle (secondary), a ghost (ghost), or a ghost in secondary text until hovered (quiet).