Beta v0.6.2

Checkbox

Checkboxes allow the user to select one or more items from a set.

Import


import { Checkbox } from "pier-ui";


Default Checkbox


<Checkbox />


With Label


Custom Color


<Checkbox color="#8b28db" defaultChecked />

Disabled

Controlled Component

It is recommended to use as a controlled component:


export default function App() {
const [isChecked, setIsChecked] = useState(false);
const [testValue, setTestValue] = useState("");
return (
<>
<Checkbox
onChange={() => {
setIsChecked(!isChecked);
setTestValue(isChecked ? "" : "blue");
}}
isChecked={isChecked}
value={testValue}
label="Check this"
/>
</>
);
}




Props

PropDescriptionTypeDefault
labellabel for the checkboxstring
classNameclassName for the componentstring
defaultCheckedIf true, the checkbox will be initially checked.booleanfalse
colorColor of the checkboxstringtheme.colors.grey
disabledbooleanfalse
requiredbooleanfalse