Switch - add onChange example to Storybook
Open
react-components
- Dominant language
- TypeScript
- Stars
- 62
- Forks
- 44
- Avg merge
- 19h 4m
- Merged PRs (30d)
- 45
Description
One thing to add either in here or in another PR at some point: `onChange` example. Here's what I roughed out on the Vite page to make sure the thing worked as I expected:
```tsx
import { useState } from "react";
import { Switch } from "@/components";
export default function SwitchPage() {
const [isSelected, setIsSelected] = useState(false);
return (
<>
Switch
Label
Reversed label position
Disabled switch
Switch on by default
setIsSelected(!isSelected)}
>
isSelected:{isSelected ? "true" : "false"}
);
}
```
_Originally posted by @ty2k in https://github.com/bcgov/design-system/pull/440#pullrequestreview-2231264689_
Contributor guide
Assessment
This issue has not been assessed yet.