@raddix/switch
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

useSwitch

npm bundle size npm

@raddix/switch is a hook that provides the behavior for a switch component.

Features

  • Full support for browser features.
  • Accessible to screen reader and keyboard navigation.
  • Doesn’t implement any rendering or impose a DOM structure, unstyled.
  • Fully-typed API

Installation

Install the primitive from your command line.

yarn add @raddix/switch
#or
pnpm add @raddix/switch

Usage

This is a simple example of how to use it. To see the options and more modes of use here.

import { useSwitch } from '@raddix/switch';
import './styles.scss';

const Switch = props => {
  const { switchProps } = useSwitch(props);

  return <div {...switchProps} className='switch'></div>;
};

Package Sidebar

Install

npm i @raddix/switch

Weekly Downloads

8

Version

1.0.6

License

MIT

Unpacked Size

16.6 kB

Total Files

17

Last publish

Collaborators

  • immois