0.2.0 • Published 4 years ago
mui-tri-state-checkbox v0.2.0
mui-tri-state-checkbox
A tri-state checkbox component (false, null, and true) built on material-ui's Checkbox
The null state represents an indeterminate state. It's like a partially checked state between false and true.
Usage
Example (Codesandbox):
import React, { useState } from 'react'
import { MuiTriStateCheckbox } from 'mui-tri-state-checkbox'
export default function Demo() {
const [checked, setChecked] = useState<boolean | null>(null)
return (
<>
<h2>Controlled (checked: {JSON.stringify(checked)})</h2>
<div>
<MuiTriStateCheckbox
value="value"
checked={checked}
onChange={(e, checked) => setChecked(checked)}
/>
</div>
</>
)
}
Demo
Start the demo with yarn start
. (To do: publish it to GitHub pages.)