Same BEM classes and behavior as Astro, Svelte, and Vue.
Add this component
The command below includes <strong>Toggle</strong>—run it in your project directory to install this component (and the CSS if needed). No prompts.
Choose your package manager — click a tab to select, then copy the command.
npm pnpm yarn bun
bashbash
npx rizzo-css add Toggle
bashbash
pnpm dlx rizzo-css add Toggle
bashbash
npx rizzo-css add Toggle
bashbash
bunx rizzo-css add Toggle
Live examples
React
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
astroastro
---
import Toggle from '../components/astro/Toggle.astro';
---
<Toggle aria-label="Toggle" pressed={false} client:load>Bold</Toggle>
htmlhtml
<!-- Rizzo CSS. Toggle state via JS (aria-pressed, class toggle--pressed). -->
<button type="button" class="toggle" aria-pressed="false">Toggle</button>
sveltesvelte
<script>
import { Toggle } from '$lib/rizzo';
let pressed = $state(false);
</script>
<Toggle bind:pressed aria-label="Toggle">Bold</Toggle>
vuevue
<script setup>
import { ref } from 'vue';
import Toggle from '@/components/rizzo/Toggle.vue';
</script>
<template>
<Toggle v-model:pressed="pressed" aria-label="Toggle">
Bold
</Toggle>
</template>