2.2.13 • Published 2 years ago

@nature-ui/clickable v2.2.13

Weekly downloads
9
License
MIT
Repository
github
Last release
2 years ago

@nature-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 '@nature-ui/clickable';

Usage

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

// use the clickable primitive
const Example = () => (
  <Clickable isDisabled isFocusable>
    {({ disabled, 'aria-disabled': Disabled }: ClickableProps) => {
      return (
        <span
          style={{
            opacity: disabled || Disabled ? 0.5 : 1,
            pointerEvents: disabled || Disabled ? 'none' : 'initial',
          }}
        >
          Clickable
        </span>
      );
    }}
  </Clickable>
);
2.2.1

2 years ago

2.2.0

2 years ago

2.2.13

2 years ago

2.2.11

2 years ago

2.2.12

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago

2.0.3-alpha.0

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.1

2 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.2.0

4 years ago

0.1.1-alpha.4

4 years ago

0.1.1-alpha.3

4 years ago

0.1.1-alpha.2

4 years ago

0.1.1-alpha.1

4 years ago

0.1.1-alpha.0

4 years ago