DEV Community

K-Sato
K-Sato

Posted on

Created a svelte tooltip library

Overview

I created a light weight tooltip library. It was my first time making a svelte library. But it was a breeze thanks to svelte-kit.

What I made

As stated above, I created a svelte-actions based tooltip library. I'll leave links to the repo and demo page here.

Repo: https://github.com/K-Sato1995/svelte-tooltip

Demo: https://svelte-tooltip-k-sato1995.vercel.app/

How to make a library with svelte-kit

svelte-kit package is currently experimental at the time of writing (2022/03/24)

svelte-kit makes creating a library super easy. The only notable difference between creating a library with svelte-kit and creating a web app with svelte-kit is the location of the public-facing stuff.

  • The location of the public facing stuff based on what you want to create
    • src/routes : for creating a web app with svelte-kit
    • src/lib: for creating a library with svelte-kit

And with that out of the way, all you have to do now is to write code and build & publish it by running the commands below.

$ npm run package // build the package from the code under src/lib
$ cd package // move to the package directory
$ npm publish // publish the package
Enter fullscreen mode Exit fullscreen mode

For more information about creating a library with svelte-kit check out the official document below.

SvelteKit docs

Top comments (3)

Collapse
 
thomas180399 profile image
Thomas Frank

This is the first time I have known about svelte-kit tool. It helps making a super mario game library easily compare to make it without tools.

Collapse
 
juiweasley profile image
Jui Weasley

Creating a tooltip library using svelte-actions sounds like a wordiply useful and practical project.

Collapse
 
celinecdd9 profile image
Celine Dion • Edited

svelte-kit is the perfect tool for creating a lightweight and io games easy-to-use tooltip libraries.