Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/rschristian/preact-hint

A tiny and flexible tooltip library for Preact applications
https://github.com/rschristian/preact-hint

component hint preact tooltip

Last synced: about 2 months ago
JSON representation

A tiny and flexible tooltip library for Preact applications

Awesome Lists containing this project

README

        

Preact Hint



NPM


Preact-Hint is a tiny component library used for displaying tooltips. Try out [the demo](https://preact-hint.rschristian.dev/)!

## Install

```
$ yarn add preact-hint
```

## Usage

```jsx
import Hint from 'preact-hint';
import 'preact-hint/dist/index.css';

export default function App() {
return (

Hover over me!

);
}
```

## API

### attribute

type: `string`

default: `data-hint`

Allows you to customize which attribute contains hint data on the element.

```jsx

Hover over me!

```

### template

type: `(content: string) => VNode`

default: `undefined`

Allows you to customize the content within the tooltip. See the following example:

```jsx
{
const stringPieces = content.split(',');
return (

{stringPieces[0]} Contributions on {stringPieces[1]}

);
}}
>
Hover over me!

```

## License

MIT © Ryan Christian