transition prop, and after scrolling the page (#3407)
* `useDidElementMove`: handle `HTMLElement` This change should be temporary, and it will allow us to use the `useDidElementMove` with ref objects and direct `HTMLElement`s. * `useResolveButtonType`: handle `HTMLElement` This change should be temporary, and it will allow us to use the `useResolveButtonType` hook with ref objects and direct `HTMLElement`s. * `useRefocusableInput`: handle `HTMLElement` This change should be temporary, and it will allow us to use the `useRefocusableInput` hook with ref objects and direct `HTMLElement`s. * `useTransition`: handle `HTMLElement` Accept `HTMLElement| null` instead of `MutableRefObject<HTMLElement | null>` in the `useTransition` hook. * ensure `containers` are a dependency of `useEffect` * `Menu`: track `button` and `items` elements in state So far we've been tracking the `button` and the the `items` DOM nodes in a ref. Typically, this is the way you do it, you keep track of it in a ref, later you can access it in a `useEffect` or similar by accessing the `ref.current`. There are some problems with this. There are places where we require the DOM element during render (for example when picking out the `.id` from the DOM node directly). Another issue is that we want to re-run some `useEffect`'s whenever the underlying DOM node changes. We currently work around that, but storing it directly in state would solve these issues because the component will re-render and we will have access to the new DOM node. * `Combobox`: track `input`, `button` and `options` elements in state * `Disclosure`: track `button` and `panel` elements in state * `Listbox`: track `button` and `options` elements in state * `Popover`: track `button` and `panel` elements in state * `Transition`: track the `container` element in state * remove incorrect leftover `style=""` attribute * simplify `useDidElementMove`, only accept `HTMLElement | null` This doesn't support the `MutableRefObject<HTMLElement | null>` anymore. * pass `HTMLElement | null` directly to `useResolveButtonType` * simplify `useResolveButtonType`, only handle `HTMLElement | null` We don't handle `MutableRefObject<HTMLElement | null>` anymore * simplify `useRefocusableInput` * simplify `useElementSize` * simplify `useOutsideClick` Only accept `HTMLElement | null` instead of `MutableRefObject<HTMLElement | null>` * do not rely on `HTMLButtonElement` being available * update changelog
Headless UI
A set of completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.
Documentation
For full documentation, visit headlessui.com.
Installing the latest version
You can install the latest version by using:
npm install @headlessui/react@latestnpm install @headlessui/vue@latest
Installing the insiders version
You can install the insiders version (which points to whatever the latest commit on the main branch is) by using:
npm install @headlessui/react@insidersnpm install @headlessui/vue@insiders
Note: The insiders build doesn't follow semver and therefore doesn't guarantee that the APIs will be the same once they are released.
Packages
| Name | Version | Downloads |
|---|---|---|
@headlessui/react |
||
@headlessui/vue |
||
@headlessui/tailwindcss |
Community
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
For casual chit-chat with others using the library:
Join the Tailwind CSS Discord Server
Contributing
If you're interested in contributing to Headless UI, please read our contributing docs before submitting a pull request.