The PR adds a settings toggle by restyling a native checkbox, or it builds a clickable div with a useState boolean and a CSS knob. The repo already has a Switch primitive with a visible label, role="switch", aria-checked, and the Space / Enter pattern already wired. Nearby notification and theme rows use it. The styled checkbox still announces as a checkbox, and the homemade div does not land in the tab order or expose state to assistive tech.
I've started treating a homemade on/off control as an incomplete component, not as a lighter switch. Flipping a boolean is the easy part. A consistent label, a real switch role, and keyboard access are why the primitive is there.
Why the homemade switch shows up
A tutorial "custom toggle" example is a hidden checkbox plus a sliding track, or a div with an onClick. The model can write that without finding components/Switch. Your primitive may wrap Radix or a design-system Switch, or it may be named Toggle or ToggleField, which is easy to miss if the prompt only says "add a toggle."
You also skip the disabled state, the label association, and the rule about not using a Switch when the job is a multi-select checkbox or a mutually exclusive radio group.
A simple Switch policy
- New binary settings use the existing Switch primitive
- Do not restyle a native checkbox to fake the design-system track
- Do not build a clickable div toggle in a feature file
- A new size or label placement is a primitive change, with a story
If the user can turn several options on at once, that is a checkbox group, not a row of Switches used as checkboxes. If exactly one option must stay selected, that is a radio group, not a Switch.
What to put in the prompt
Use the existing Switch primitive for this on/off setting.
Do not restyle a native checkbox, and do not build a clickable div in this file.
Keep the label, the switch role, and keyboard activation on the primitive.
If the control is multi-select or mutually exclusive, use the existing Checkbox or Radio group instead.
Paste one existing Switch usage. In review, search the diff for a raw <input type="checkbox"> used as a settings toggle, a role="switch" that is not the primitive, and a useState boolean around a homemade track.
Reject / send back
Reject
- A feature-level settings toggle that reimplements the Switch primitive
- A native checkbox restyled to look like the design-system track
- A
divthat only works with a pointer and ignores Space and Enter - A second toggle library added for one settings row
Accept
- A setting that uses the existing Switch primitive
- A primitive PR that adds a documented size or label placement and a story
- A multi-select or exclusive choice that stays on the existing Checkbox or Radio group
Top comments (0)