Demo
Toggle buttons
Documented in ToggleButton.
Toggle buttons
An uncontrolled toggle button and a controlled one whose pressed state the parent owns.
Muted: false
Demo.tsx
'use client';
import { useState } from 'react';
import { ToggleButton } from '@salmonui/buttons/button';
// An uncontrolled toggle and a controlled one whose state the parent owns.
export default function ToggleButtonDemo() {
const [muted, setMuted] = useState(false);
return (
<div style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 8 }}>
<ToggleButton defaultPressed>Bold</ToggleButton>
<ToggleButton variant="outline" tone="primary" pressed={muted} onPressedChange={setMuted}>
Mute
</ToggleButton>
<span>Muted: {String(muted)}</span>
</div>
);
}
This demo has no notes.