JSPM

@chakra-ui/clickable

0.0.0-dev-202211720414
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 452834
  • Score
    100M100P100Q192266F
  • License MIT

React hook and component that implements native button interactions

Package Exports

  • @chakra-ui/clickable
  • @chakra-ui/clickable/dist/chakra-ui-clickable.cjs.js
  • @chakra-ui/clickable/dist/chakra-ui-clickable.esm.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@chakra-ui/clickable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@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>
)