Copy To Clipboard
Component for copying text values to the clipboard with visual feedback
Same BEM classes and behavior as Astro, Svelte, and Vue.
Add this component
Run the command below in your project directory. When prompted, select the component(s) you want. The CLI will copy the CSS and component files.
Choose your package manager — click a tab to select, then copy the command.
Live examples
Usage
Usage
Full example for each framework (Astro, Vanilla, Svelte, Vue, React). Switch framework via View as or by clicking a Usage tab—both stay in sync.
Astro Vanilla Svelte Vue React ---
import CopyToClipboard from '../components/astro/CopyToClipboard.astro';
---
<CopyToClipboard value="npm install rizzo-css" label="Copy" />
<!-- Ensure Rizzo CSS and js/main.js are loaded. -->
<button type="button" class="btn" data-copy-value="npm install rizzo-css">Copy</button>
<script>
import { CopyToClipboard } from '$lib/rizzo';
</script>
<CopyToClipboard value="npm install rizzo-css" label="Copy" />
<script setup>
import CopyToClipboard from '@/components/rizzo/CopyToClipboard.vue';
</script>
<template>
<CopyToClipboard value="npm install rizzo-css" label="Copy" />
</template>
import { CopyToClipboard } from './components/react';
<CopyToClipboard value="npm install rizzo-css" label="Copy" />
Other frameworks: Astro · Vanilla · Svelte · Vue