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

1.0.0-rc.9 • Public • Published

@chakra-ui/clickable

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

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

Installation

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

Usage

// create a clickable primitive
const Clickable = (props) => {
  const clickable = useClickable(props)
  return <chakra.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>
)

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.0-rc.97latest
1.0.0-rc-.421next

Version History

VersionDownloads (Last 7 Days)Published
1.0.0-rc-.421
1.0.0-rc.112
1.0.0-rc.97

Package Sidebar

Install

npm i @hackr/chakra-ui-clickable

Weekly Downloads

10

Version

1.0.0-rc.9

License

MIT

Unpacked Size

8.51 kB

Total Files

4

Last publish

Collaborators

  • gnuns