Skip to content
BigBang

Popular

    ↑↓Navigate↵OpenEscClose
    TR

    Components

    Copy

    A button that copies a value to the clipboard, confirms it with a check mark and announces it.

    Storybook
    Storybook
    Source
    Source

    The example below loads live from Storybook; open it there to use the controls.

    Live example, StorybookOpen in Storybook

    icon is icon-only with a tooltip; button has text; inline shows the value with an icon button after it.

    REF-2048-7731
    import { Copy, Provider } from '@bigbang/ui';
    export default function Default() {
    return (
    <Provider locale="en-GB">
    <div className="flex flex-wrap items-center gap-lg">
    <Copy value="REF-2048-7731" label="Copy reference code" copiedLabel="Reference code copied" />
    <Copy value="REF-2048-7731" variant="button" />
    <Copy value="REF-2048-7731" variant="inline" label="Copy reference code" copiedLabel="Reference code copied" />
    </div>
    </Provider>
    );
    }

    children changes the text shown; value is always what goes to the clipboard.

    Reference code
    REF-2048-7731
    Invitation link
    example.com/invite/7Q2K
    import { Copy, Provider } from '@bigbang/ui';
    export default function Inline() {
    return (
    <Provider locale="en-GB">
    <dl className="flex flex-col gap-md">
    <div className="flex flex-col gap-xxs">
    <dt className="type-label-sm text-fg-subtle">Reference code</dt>
    <dd>
    <Copy value="REF-2048-7731" variant="inline" label="Copy reference code" copiedLabel="Reference code copied" />
    </dd>
    </div>
    <div className="flex flex-col gap-xxs">
    <dt className="type-label-sm text-fg-subtle">Invitation link</dt>
    <dd>
    <Copy value="https://example.com/invite/7Q2K" variant="inline">
    example.com/invite/7Q2K
    </Copy>
    </dd>
    </div>
    </dl>
    </Provider>
    );
    }

    The button colours are the Button ones.

    REF-2048-7731
    REF-2048-7731
    import { Copy, Provider } from '@bigbang/ui';
    export default function Default() {
    return (
    <Provider locale="en-GB">
    <div className="flex flex-wrap items-center gap-lg">
    <Copy value="REF-2048-7731" label="Copy reference code" copiedLabel="Reference code copied" />
    <Copy value="REF-2048-7731" variant="button" />
    <Copy value="REF-2048-7731" variant="inline" label="Copy reference code" copiedLabel="Reference code copied" />
    </div>
    </Provider>
    );
    }