An open API service indexing awesome lists of open source software.

https://github.com/fouita/svelte-tw-tooltip

Tooltip works with svelte and tailwindcss
https://github.com/fouita/svelte-tw-tooltip

Last synced: 3 months ago
JSON representation

Tooltip works with svelte and tailwindcss

Awesome Lists containing this project

README

          

## Svelte and Tailwind tooltip component

Easy to use Tooltip component for your svelte and tailwindcss projects

## Install

```bash
$npm i @fouita/tooltip -D
```

## Usage

Import the tooltip component and use it like the following

![fouita tooltip](https://cdn.fouita.com/assets/pics/template/tooltip/tooltip-simple.jpg)

```html

import Tooltip from '@fouita/tooltip'


Element 1


```

### Positions
* top
* left
* right
* bottom

### Pointer
* start
* middle
* end

## Change Color

You can use `color` and `text_color` props to customize the color

![fouita tooltip](https://cdn.fouita.com/assets/pics/template/tooltip/tooltip-color.jpg)

```html


Element 1


```

## Hover action

To show the tooltip when hovering on an element you can use `on:mouseenter` and `on:mouseleave` events and toggle a show flag, like the following.

![fouita tooltip](https://cdn.fouita.com/assets/pics/template/tooltip/tooltip-hover.jpg)

```html

import Tooltip from '@fouita/tooltip'
let show_elm = false

show_elm=true} on:mouseleave={() => show_elm=false}>
Hover


```

We can also customize the width of the tooltip by adding `w` attribute and use the scale used in tailwindcss.

## Custom content

To add custom content to a tooltip we can just add children tags and add some html

![fouita tooltip](https://cdn.fouita.com/assets/pics/template/tooltip/tooltip-click.jpg)

```html

import Tooltip from '@fouita/tooltip'
let show_elm = false

show_elm=!show_elm} >
Click


Custom Content!

Lorem ipsum dolor sit, amet consectetur adipisicing elit. Quos dolores excepturi placeat, eos et iste magnam illo voluptates veritatis exercitationem laborum, doloremque eius omnis, enim corrupti inventore rem vero assumenda.



Great!




```

## About

[Fouita : UI framework for svelte + tailwind components](https://fouita.com)