1.1.0 • Published 3 years ago

@pmwcs/checkbox v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

Checkboxes

Checkboxes allow the user to select multiple options from a set.

function Example() {
  const [checked, setChecked] = React.useState(false);
  return (
    <Checkbox
      label="Cookies"
      checked={checked}
      onChange={evt => setChecked(!!evt.currentTarget.checked)}
    />
  );
}
<Checkbox label="Pizza" />
<Checkbox>Icecream</Checkbox>
<>
  <Checkbox label="Broccoli" indeterminate />

  <Checkbox label="Always On" checked />
  <Checkbox label="Always Off" checked={false} />
</>

Checkbox

A Checkbox component.

Props

NameTypeDescription
checkedundefined \| false \| trueToggle the control on and off.
disabledundefined \| false \| trueDisables the control.
foundationRefReact.Ref<MDCCheckboxFoundation>Advanced: A reference to the MDCFoundation.
idundefined \| stringA DOM ID for the toggle.
indeterminateundefined \| false \| trueMake the control indeterminate
inputRefReact.Ref<HTMLInputElement>A reference to the native input.
labelReact.ReactNodeA label for the control.
rippleRipplePropTAdds a ripple effect to the component
rootPropsReact.HTMLProps<any>By default, all props except className and style spread to the input. These are additional props for the root of the checkbox.
valuestring \| number \| string[]The value of the control.