Headless UI for for creating flexible and accessible expand/collapse components in TS/JS. Includes adapter for React.
5e427ec: This is a big refactor of react-collapsed
, enough I wanted to denote it with a new major version.
expandStyles
and collapseStyles
options have been removed.
onExpandStart
, onExpandEnd
, onCollapseStart
, onCollapseEnd
options have been removed and replaced with onTransitionStateChange
:
const useCollapse({
onTransitionStateChange(stage) {
switch (stage) {
case 'expandStart':
case 'expandEnd':
case 'expanding':
case 'collapseStart':
case 'collapseEnd':
case 'collapsing':
// do thing
default:
break;
}
}
})
React.useId
if it's available.ReactDOM.flushSync
to update styles in transition.role="region"
to collapse.'transitionend'
event. Should fix #103.getCollapseProps
and getToggleProps
, so their arguments and return type is more accurately typed. This should help catch cases when props returned by the getters are duplicated on the component (such as ref
or style
).getToggleProps
depending on the HTML tag of the component.1ee93e8:
useId
, making the library incompatible with React <18tsup
from microbundle
for bundling library. No longer exports a UMD version, just CJS and MJSonExpandedChange
optiongetToggleProps
is used. If the toggle element ref can be accessed, the aria-labelledby
attribute will be added to the collapse elementrole="region"
to collapse1ee93e8:
useId
, making the library incompatible with React <18tsup
from microbundle
for bundling library. No longer exports a UMD version, just CJS and MJSonExpandedChange
optiongetToggleProps
is used. If the toggle element ref can be accessed, the aria-labelledby
attribute will be added to the collapse elementrole="region"
to collapse