@wudev/button-for
v1.0.0
Published
[](https://www.npmjs.com/package/@wudev/button-for) [](https://sgb004.com)
Readme
ButtonFor
This component adds a for attribute to a <button /> so that it works similarly to how the <label /> tag does, with the particularity that it works to open or close <dialog /> tags.
Installation
To install ButtonFor you can use npm:
npm install @wudev/button-forUsage
Import the component and add the htmlFor attribute to tell it witch element it should interact with.
It is possible to pass it an id like <label /> tag or pass it a reference to a <dialog />or <input type="checkbox|radio" />.
import ButtonFor from '@wudev/button-for';
<ButtonFor htmlFor="id-of-dialog-or-input-checkbox-radio">Click me!</ButtonFor>
<ButtonFor htmlFor={refOfDialogOrInputCheckboxRadio}>Click me!</ButtonFor>