Svelte Legos
Collection of essential Svelte Composition Utilities
🚀 Features
- 🎪 Interactive docs & demos
- ⚡ Fully tree shakeable: Only take what you want, [bundle size]
- 🦾 Type Strong: Written in TypeScript, with TS Docs
- 🔋 SSR Friendly
- 🌎 No bundler required: Usable via CDN
- 🔩 Flexible: Configurable event filters and targets
🦄 Usage
<script lang="ts">
import { useCounter } from "$lib";
const { counter, inc, dec, set, reset } = useCounter();
</script>
<button on:click={() => inc()}>Increment</button>
{counter}
<button on:click={() => dec()}>Decrement</button>
<script lang="ts">
import { useWindowSize } from "$lib";
const size = useWindowSize();
</script>
<div>{$size.width}</div>
<div>{$size.height}</div>
Refer to functions list or documentations for more details.
📦 Install
npm i svelte-legos
🌸 Thanks
This project is heavily inspired by the following awesome projects.