Hooks
Headless interaction primitives and reactive utilities exported from moraine/utils.
Moraine exports its headless interaction primitives and reactive utilities from the moraine/utils entry point. These hooks back Moraine’s own components. Use them to build custom controls.
Import#
Import hooks from the moraine/utils subpath:
The styling helpers cn, createCn, and useCn are exported from moraine, not moraine/utils. See Class Merging.
Headless Hooks#
- createBaseSelectSearchInput
Bind a custom text input to BaseSelect with accessible keyboard and IME behavior.
- createControllableValue
Bridge controlled and uncontrolled component state with a single reactive accessor and setter pair.
- createCopy
Reactive clipboard primitive with duration-based status, ClipboardItem support, and an execCommand fallback.
- createDisclosureState
Track open state, content height, and data-attribute getters for collapsible panels.
- createEventListener
Attach typed DOM event listeners that clean up automatically when the Solid owner scope disposes.
- createId
Generate unique, SSR-safe identifiers for accessibility relationships and form controls.
- createMediaQuery
Create a reactive boolean accessor tracking the match status of any CSS media query.
- createSelectableCollectionNavigation
Add accessible keyboard navigation (arrow keys, Home/End, RTL) for tabs, radio groups, and listboxes.
- createSlider
Headless pointer dragging, keyboard stepping, step snapping, and thumb styles for single or multi-thumb range sliders.
- createTransitionPresence
Keep an element mounted until its CSS exit animation finishes.