Socket
Socket
Sign inDemoInstall

@12joan/preact-hint

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@12joan/preact-hint

Tooltip Component for Preact


Version published
Weekly downloads
27
increased by3.85%
Maintainers
1
Weekly downloads
 
Created
Source

Preact Hint

NPM

Preact-Hint is a tiny component library used for displaying tooltips. Try out the demo!

Install

$ yarn add preact-hint

Usage

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

export default function App() {
    return (
        <Hint>
            <button data-hint="Hello World!">Hover over me!</button>
        </Hint>
    );
}

API

attribute

type: string
default: data-hint

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

<Hint attribute="data-foo">
    <button data-foo="Hello World!">Hover over me!</button>
</Hint>

template

type: (content: string) => VNode
default: undefined

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

<Hint
    template={(content) => {
        const stringPieces = content.split(',');
        return (
            <Fragment>
                <strong>{stringPieces[0]} Contributions</strong> on {stringPieces[1]}
            </Fragment>
        );
    }}
>
    <button data-hint={['0', '2019-09-14']}>Hover over me!</button>
</Hint>

License

MIT © Ryan Christian

Keywords

FAQs

Package last updated on 08 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc