Skip to content

Releases: tailwindlabs/headlessui

@headlessui/vue@v1.7.22

08 May 10:55
7004a25
Compare
Choose a tag to compare

Fixed

  • Don’t cancel touchmove on input elements inside a dialog (#3166)
  • Ensure clicking a ComboboxOption after filtering the options, correctly triggers a change (#3180)

@headlessui/react@v2.0.3

07 May 18:17
Compare
Choose a tag to compare

Fixed

  • Make sure disabling demo mode on <Combobox> works (#3182)

@headlessui/react@v2.0.2

07 May 17:20
48cf712
Compare
Choose a tag to compare

Fixed

  • Improve performance of internal useInertOthers hook (#3181)

@headlessui/react@v2.0.1

06 May 19:10
Compare
Choose a tag to compare

Fixed

  • Remove accidental deprecation comments on <DialogPanel> and <DialogTitle> (#3176)

@headlessui/react@v2.0.0

06 May 15:46
fb13190
Compare
Choose a tag to compare

Headless UI v2.0

We just released Headless UI v2.0 for React which includes a ton of new stuff:

  • Built-in anchor positioning — using Floating UI, components like Menu, Listbox, and more can now automatically position their popovers to be anchored to their trigger, adapting as needed to changes in the viewport.
  • Headless checkbox component — we've added a headless Checkbox component to complement our existing RadioGroup component, making it easy to build totally custom checkbox controls.
  • HTML form components — we've added Input, Select, Textarea, Label, Description, Fieldset, and Legend components that handle all of the ID generation and aria-* attribute mapping you need to do to connect form fields together.
  • Improved hover and focus-visible detection — using hooks from the awesome React Aria library under the hood, Headless UI now adds smarter data-hover and data-focus attributes to your controls that behave more consistently across different devices than the native pseudo-classes.
  • Combobox list virtualization — the Combobox component can now handle giant lists of options with no performance issues.

Changelog

Added

  • Add new Checkbox component (#2887, #2962)
  • Add new Button component (#2887)
  • Add new Input component (#2887, #2902, #2940)
  • Add new Textarea component (#2887, #2902, #2940)
  • Add new Select component (#2887, #2902)
  • Add new Fieldset and Legend components (#2887)
  • Add new Field, Label, Description components (#2887, #2941)
  • Add new MenuSection, MenuHeading, and MenuSeparator components (#2887)
  • Add new ListboxSelectedOption component (#2887)
  • Add new DataInteractive component (#2887)
  • Add new CloseButton component and useClose hook (#3096)
  • Add new anchor, modal, and portal props to Combobox, Listbox, Menu and Popover components (#2887, #3075, #3097, #3111, #3115, #3121, #3124, #3133, #3138, #3148, #3152, #3154, #3157)
  • Add new autoFocus prop to focusable components (#2887)
  • Add new virtual prop to Combobox component (#2779, #3128, #3160, #3161, #3163)
  • Add new onClose prop to Combobox component (#3122)
  • Add new immediate prop to Combobox for immediately opening the Combobox when the input receives focus (#2686)
  • Add new --button-width CSS variable on the ListboxOptions, MenuItems, and PopoverPanel components (#2887, #3058)
  • Add new --input-width and --button-width CSS variables on the ComboboxOptions component (#3057)
  • Add new data-* attributes as an alternative to the existing data-headlessui-state attribute (#2887, #3035, #3061)

Fixed

  • Fix scroll-locking on iOS (#2891)
  • Fix cancellation of events when using disabled or aria-disabled attributes (#2890)
  • Fix unnecessary execution of the displayValue callback in ComboboxInput component (#3048)
  • Fix types for multiple prop in Combobox component (#3099)
  • Fix focus handling in ComboboxInput component (#3065, #3073)
  • Fix enter transitions in Transition component (#3074)
  • Fix focus handling in ListboxOptions and MenuItems components (#3112)
  • Fix horizontal scrolling inside the Dialog component (#2889)

Changed

  • Require React 18 (#2887, #3092, #3131)
  • Always render hidden form input fields for Checkbox, Switch and RadioGroup components (#3095)
  • Deprecate the RadioGroup.Option component in favor of new Radio component (#2887)
  • Deprecate the active prop in favor of new focus prop (#2887)
  • Dialog is now focused by default instead of the first focusable element (#2887)
  • Change default tags for ListboxOptions, ListboxOption, ComboboxOptions, ComboboxOption, and TabGroup components (#3109)
  • Change default tag from div to Fragment on Transition components (#3110, #3147)
  • Allow Combobox component to have null value (#3064, #3100)
  • Attempt form submission when pressing enter on the ListboxButton component (#2972)
  • Deprecate the entered prop on the Transition component (#3089)
  • Add frozen value to ComboboxOptions component (#3126)

Upgrading from v1

Update dependencies

Install the latest version of the package via npm:

npm install @headlessui/react@latest

Comboboxes now always support empty values

Previously the Combobox component required an option to always be set, and you could opt out of this behavior using the nullable prop. In v2.0 comboboxes support empty values by default so you can remove this prop:

- <Combobox value={selected} onChange={setSelected} nullable>
+ <Combobox value={selected} onChange={setSelected}>

If you'd like to keep the previous behavior, update your onChange callback to only set the selected value if an option has actually been selected:

 <Combobox
   value={selected}
-  onChange={setSelected}
+  onChange={(newValue) => setSelected((oldValue) => newValue ?? oldValue)}
   onClose={() => setQuery('')}
 >

New default elements

The default rendered element has changed for a number of components in v2.0:

Component v1.x element v2.0 element
Transition div Fragment
TransitionRoot div Fragment
TransitionChild div Fragment
ListboxOptions ul div
ListboxOption li div
ComboboxOptions ul div
ComboboxOption li div
TabGroup Fragment div

If you're relying on a default element that has change, you can preserve that behavior using the as prop:

- <Transition ...>
+ <Transition as="div" ...>

##...

Read more

@headlessui/vue@v1.7.21

26 Apr 19:00
Compare
Choose a tag to compare

Fixed

  • Prevent closing the Combobox component when clicking inside the scrollbar area (#3104)
  • Don’t unmount portal targets used by other portals (#3144)

@headlessui/vue@v1.7.20

15 Apr 15:40
be95227
Compare
Choose a tag to compare

Fixed

  • Expose disabled state on <Tab /> component (#2918)
  • Prevent default behaviour when clicking outside of a DialogPanel (#2919)
  • Don’t override explicit disabled prop for components inside <MenuItem> (#2929)
  • Add hidden attribute to internal <Hidden /> component when the Features.Hidden feature is used (#2955)
  • Allow setting custom tabIndex on the <Switch /> component (#2966)
  • Forward disabled state to hidden inputs in form-like components (#3004)
  • Respect selectedIndex for controlled <Tab/> components (#3037)

@headlessui/react@v1.7.19

15 Apr 15:40
8599e49
Compare
Choose a tag to compare

Fixed

  • Make sure panels re-register when IDs are calculated in React < 18 (#2883)
  • Expose disabled state on <Tab /> component (#2918)
  • Prevent default behaviour when clicking outside of a Dialog.Panel (#2919)
  • Add hidden attribute to internal <Hidden /> component when the Features.Hidden feature is used (#2955)
  • Allow setting custom tabIndex on the <Switch /> component (#2966)
  • Forward disabled state to hidden inputs in form-like components (#3004)
  • Respect selectedIndex for controlled <Tab/> components (#3037)

@headlessui/vue@v1.7.19

07 Feb 21:50
Compare
Choose a tag to compare
  • Fix Combobox activeOption render prop (#2973)

@headlessui/vue@v1.7.18

02 Feb 20:40
Compare
Choose a tag to compare

Added

  • Allow users customize ID generation (#2959)