Skip to content

2nthony/svelte-use

Repository files navigation

Svelte Use

Fork from @vueuse/vueuse

Install

npm i @svelte-use/core

Usage

<script>
  import { usePreferredDark, usePreferredDark } from '@svelte-use/core'

  // is user prefers dark theme
  const isDark = usePreferredDark()

  // persist state in localStorage
  const storage = useLocalStorage({
    'my-storage',
    {
      name: 'Apple',
      color: 'red'
    }
  })
</script>

Refer to functions list or documentations for more detauls.

Thanks

This project is heavily inspired by the following awesome projects.

License

MIT license © 2021-PRESENT 2nthony