tailwindlabs / headlessui

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.
https://headlessui.com
MIT License
25.81k stars 1.07k forks source link

Mark `SwitchGroup` as deprecated, prefer `Field` instead #3232

Closed RobinMalfait closed 4 months ago

RobinMalfait commented 4 months ago

This PR marks the SwitchGroup component as deprecated in favor of the new <Field> component.

The SwitchGroup component was useful if you wanted to link a <Switch> and a <Switch.Label> together. However, now we have more generic components that allows you to do this instead and is more consistent with all other components as well.

E.g.:

<Switch.Group>
 <Switch.Label>Label</Switch.Label>
 <Switch />
</Switch.Group>

↓↓↓↓

<SwitchGroup>
 <SwitchLabel>Label</SwitchLabel>
 <Switch />
</SwitchGroup>

↓↓↓↓

<Field>
 <Label>Label</Label>
 <Switch />
</Field>

This Field and Label component combination can also be used with other components like Checkbox, Combobox, Input, Listbox, Radio, Select, and Textarea.

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2024 9:11pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2024 9:11pm