Collection of essential Svelte Utility Functions. ⚠️ Sveltuse is currently in early development and APIs and packages are likely to change quite often.
npm install sveltuse
yarn add sveltuse # Using yarn
pnpm install sveltuse # Using pnpm
import {
useCounter,
useMediaQuery,
useBreakpoints,
breakpointsTailwind
} from 'sveltuse'
const { count, inc, dec, set, reset } = useCounter(1, { min: 0, max: 100 })
const breakpoints = useBreakpoints(breakpointsTailwind)
const isLargeScreen = useMediaQuery('(min-width: 1024px)')
const isPreferredDark = useMediaQuery('(prefers-color-scheme: dark)')
Refer to functions list or documentations for more details.
See Usage, api and examples in sveltuse documentations.
Please read how to contribute if you'd like to be part of the Sveltuse community of contributors.
Sveltuse is open-source under the MIT License.