A collection of zero-dependency hooks for SolidJS forked directly from Mantine Hooks.
Install it:
npm i bagon-hooks
# or
yarn add bagon-hooks
# or
pnpm add bagon-hooks
# or
bun add bagon-hooks
Use it:
import { useHotkeys } from 'bagon-hooks';
We want to achieve as 1:1 as possible with Mantine's original hooks. So you can always refer to their original docs. There are a few improvements and renaming because SolidJS has its own conventions. But just take note:
- We removed Solid's convention of
use
vscreate
as it's too confusing for familiarity with Mantine. So every hook in Bagon is prefixed withuse
. - The only renaming we did was
state
->signal
. - Refer to Mantine's original docs for deeper examples and usecases.
- Refer to Bagon Hooks's docs for actual SolidJS examples.
- π³ Tree-shakable
- ποΈ TypeScript support
- π΅ For SolidJS
- π¦ Zero-dependencies (except Solid)
Based on the @mantine/hooks library.
-
use-callback-ref(Not needed, only used internally by mantine for preventing re-renders on a function) - use-click-outside
- use-clipboard
- use-color-scheme
- use-counter
- use-debounced-callback
-
use-debounced-stateuse-debounced-signal - use-debounced-value
- use-did-update
- use-disclosure
- use-document-title
- use-document-visibility
- use-event-listener
- use-eye-dropper (β¨ improved, state management is inside the hook)
- use-favicon (β¨ improved, more flexible, better control)
- use-fetch
- use-focus-return
- use-focus-trap
- use-focus-within
- use-force-update
- use-fullscreen
- use-hash
- use-headroom
- use-hotkeys
- use-hover
- use-id (Added, but note that there is
createUniqueId
in Solid) - use-idle (Added, but note that there is
createIdleTimer
the official solid-primitives as well) - use-in-viewport
- use-input-state
- use-intersection (Added, but note that there is
createIntersectionObserver
in the official solid-primitives as well) - use-interval
-
use-is-first-render(Every component function in SolidJS runs only once! Every component is first render only π) -
use-isomorphic-effect(Solid'screateEffect
is technically already isomorphic because it doesn't error on SSR. Also, it also only runs on client-side.) - use-list-state
- use-local-storage
- use-local-storage-store (β¨ Improved, more similar to 'createStore' API).
- use-logger
- use-map
- use-media-query
- use-merged-ref
- use-mounted
- use-mouse
- use-move
- use-mutation-observer
- use-network
- use-orientation
- use-os
- use-page-leave
- use-pagination
- use-previous
- use-queue
- use-reduced-motion
- use-resize-observer
- use-scroll-into-view
- use-session-storage
- use-set-state
- use-set
- use-shallow-effect
- use-state-history
- use-text-selection
- use-throttled-callback
- use-throttled-state
- use-throttled-value
- use-timeout
- use-toggle
- use-uncontrolled
- use-validated-state
- use-viewport-size
- use-window-event
- use-window-scroll
- utils
- use-keyboard
- Docs Website (Powered by mdx + tailwind prose)
- Examples
- Tests?
This library is far from done. If you have time implementing the roadmap, feel free to submit a pull request. We always appreciate collaborators. If you find anything outdated, please make an issue. If you like this project, consider giving it a star! βοΈ
This project is licensed under the MIT License
- Mantine Hooks - amazing library for components and hooks, but currently not in SolidJS so we forked that part only.