@svelkit/hooks
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

@svelkit/hooks

common hooks for svelte (part of svelkit)

License Latest Release View changelog Bundle Size

What?

A hook is a function that must be called during component initialization.

Why?

Installation

npm install @svelkit/hooks

And then import it:

// using es modules
import { useAutoId } from '@svelkit/hooks'

// common.js
const { useAutoId } = require('@svelkit/hooks')

Alternatively use UNPKG or jsDelivr packages.

Hotlinking from unpkg: (no build tool needed!)

import { useAutoId } from 'https://unpkg.com/@svelkit/hooks?module'

Usage

<script>
  import { useAutoId } from '@svelkit/hooks';

  const autoId = useAutoId('my-form');
</script>

<label for="{autoId('name')}">Name</label>
<input id="{autoId('name')}">

<label for="{autoId('email')}">E-Mail</label>
<input id="{autoId('email')}" type="email">

License

svelkit is open source software licensed as MIT.

Readme

Keywords

Package Sidebar

Install

npm i @svelkit/hooks

Weekly Downloads

6

Version

0.1.4

License

MIT

Unpacked Size

17.4 kB

Total Files

16

Last publish

Collaborators

  • sastan