Commit 59e6684f by Sarah Fischmann

adding README

parent e5ea2130
# Checkbox Component
Checkbox based off of the [WAI-ARIA authoring guidelines for the checkbox component](https://www.w3.org/TR/wai-aria-1.1/#checkbox). The checkbox is an HTMl input element with added attributes to ensure proper functionality and accessibility. The checkbox is wrapped in an `asInput` component. The `asInput` wrapper is passed the input element as well as a second parameter set to `false` to ensure that the label is placed to the right of the checkbox.
The following inputs should be passed into every checkbox component:
* `name`: `name` attribute - type `String`
* `label`: label to be placed next to the checkbox - type `String`
* `checked`: `"true"` if the default state should be checked, `"false"` otherwise - type `String`
The following input can optionally be passed into a checkbox component:
* `disabled`: `true` if the checkbox should be disabled, `false` otherwise - type `Boolean`
* `onChangeState`: function to be called when the checkbox changes state
The implementation of the checkbox contains the following functions:
* `constructor()`: The constructor sets the `id` for the checkbox and sets whether the initial state should be checked or unchecked
* `handleClick()`: Switches the state of the checkbox; also calls the `onChangeState()` function if one has been passed in
* '`render()`: Returns the checkbox as an input element with seven attributes: `id`, `type`, `name`, `defaultChecked`, `aria-checked`, `onClick`, and `disabled`.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment