Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Joy UI Switch Accessibility code example #108

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/data/joy/components/switch/switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Here are a few tips to make sure you have an accessible switch component:
This includes radio buttons, checkboxes, and switches.
In most cases, this is done using the `<label>` element.
- If a label can't be applied, make sure to add an attribute (e.g. `aria-label`, `aria-labelledby`, `title`) to the input slot inside the `slotProps` prop.

```jsx
<Switch value="checkedA" slotProps={{ 'aria-label': 'Switch A' }} />
<Switch value="checkedA" slotProps={{ input: { 'aria-label': 'Switch A' } }} />
```