mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-05 20:44:07 +08:00
15 lines
462 B
TypeScript
15 lines
462 B
TypeScript
import styles from "./Switch.module.scss";
|
|
|
|
export function Switch({ checked, disabled, label, onChange }: { checked: boolean; disabled?: boolean; label: string; onChange: (checked: boolean) => void }) {
|
|
return <button
|
|
type="button"
|
|
role="switch"
|
|
aria-checked={checked}
|
|
aria-label={label}
|
|
disabled={disabled}
|
|
className={styles.root}
|
|
data-checked={checked || undefined}
|
|
onClick={() => onChange(!checked)}
|
|
><span /></button>;
|
|
}
|