Improved: useModal now supports sheet mode and container scoping
useModal in @trackunit/react-modal has been updated with sheet mode support and container scoping. Modals can now automatically adapt to a sheet presentation when rendered inside a narrow container.
Changes to useModal
New return values
| Name | Type | Description |
|---|---|---|
mode | "card" | "sheet" | Current presentation mode |
dismiss | function | Programmatically dismiss with options |
onCloseComplete | function | Callback fired after close animation finishes |
container | element | The scoping container element |
stack | array | Modal stack state |
Removed return values
depthFromFront— removedstackSizeAtOpen— removed
New prop: container
Pass a container element to useModal to scope the modal to that element. When the container's width is less than 480 px, the modal automatically switches to sheet mode.
Updated: ModalDismissOptions
ModalDismissOptions now extends the shared DismissOptions type from @trackunit/react-components, aligning dismiss behaviour across overlay components.