@bianic-ui/clickable
TypeScript icon, indicating that this package has built-in type declarations

0.1.0-alpha.2 • Public • Published

@bianic-ui/clickable

React hook that implements all the interactions of a native button component with support for making it focusable even if it's disabled.

It can be used with both native button elements or other elements (like div).

Installation

import { useClickable } from "@bianic-ui/clickable"

Usage

// create a clickable primitive
const Clickable = (props) => {
  const clickable = useClickable(props)
  return <bianic.button display="inline-flex" {...clickable} />
}

// use the clickable primitive
const Example = () => (
  <Clickable
    as="div"
    onClick={(event) => {
      alert("clicked")
    }}
    _active={{ bg: "blue", color: "white" }}
    _disabled={{ opacity: 0.4, pointerEvents: "none" }}
  >
    Clickable
  </Clickable>
)

Package Sidebar

Install

npm i @bianic-ui/clickable

Weekly Downloads

1

Version

0.1.0-alpha.2

License

MIT

Unpacked Size

82.3 kB

Total Files

14

Last publish

Collaborators

  • ilmimris