Checker
A variation of the Radio element.
The Checker component can be used in place of the HTML Radio element and it is a different variation of the Radio component.
To use the Checker component, it has to be imported just like every other component as shown in the example below.
When Checker
is imported, it comes in two variations, dotted styled
and flat styled
. The Checker
component also comes in the active
(default state) and disabled
state.
The dotted styled variation of the Checker component is the default.
As seen above the Checker
component accepts properties such as the disabled
, style
, label
, buttons
, name
, canClear
and onChange
.
The disabled
props accepts a value of true or false but has a default of true.
The style
props has a fixed value of either Dot
or Flat
. This fixed style comes as the properties of an object (Checker.Styles) that is embedded with the Checker component.
The properties Dot and Flat are in sentence case.
The label
props is an optional props and if is omitted, the label indicator disappears from the component. The buttons
props accepts an array of strings which is used to create the options for the buttons and the name
props accepts a string used to interact with the form.
The canClear
accepts a boolean. If set to true, the user can reset their selection. The onChange
props accepts a callback function.
The Checker components can also be used with react-hook-form as shown below.
Last updated
Was this helpful?