Hooks
Apollion ships the hooks its components are built on. Import them from the
@apollion-dsi/core/hooks subpath.Hooks@apollion-dsi/core/hooks15.7 kB gzip
Hook | What it is for |
|---|---|
Run a callback when the user presses outside an element. | |
Keep keyboard focus inside a modal surface. | |
Run a callback when an element scrolls into view. | |
Read the active viewport band from the theme breakpoints. | |
Turn an element into a file drop zone. | |
Validate files chosen in a file input. | |
Warn before the user leaves the page. | |
Manage a boolean with enable, disable and toggle. | |
Get a stable callback that always calls the latest function. | |
Run an effect on updates only, never on mount. | |
Simulate progress from a start value to 100 on a timer. | |
Keep an element mounted until its CSS exit transition ends. | |
Copy text and show a temporary "copied" state. | |
Load an external script once and know when it is ready. |
Scrolls sideways inside the table. The page does not.
import { useToggle, useMediaQuery } from '@apollion-dsi/core/hooks';