https://github.com/tylerrick/mui-tri-state-checkbox
A tri-state checkbox component (false, null, or true) built on material-ui Checkbox
https://github.com/tylerrick/mui-tri-state-checkbox
Last synced: 11 months ago
JSON representation
A tri-state checkbox component (false, null, or true) built on material-ui Checkbox
- Host: GitHub
- URL: https://github.com/tylerrick/mui-tri-state-checkbox
- Owner: TylerRick
- License: mit
- Created: 2019-12-06T07:42:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T02:26:08.000Z (over 3 years ago)
- Last Synced: 2025-07-21T02:46:03.534Z (11 months ago)
- Language: TypeScript
- Size: 3.78 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 25
-
Metadata Files:
- Readme: Readme.md
- License: License
Awesome Lists containing this project
README
# mui-tri-state-checkbox
[](https://badge.fury.io/js/mui-tri-state-checkbox)
A tri-state checkbox component (false, null, or true) built on [material-ui](https://material-ui.com/)'s [Checkbox](https://material-ui.com/api/checkbox/)
The `null` state represents an indeterminate state. It's like a "partially checked" state in between `false` and `true`.
Useful for indicating that it is not yet known whether the value is `true` or `false` (such as when the user has never selected a value yet).
# Usage
Example ([Codesandbox](https://codesandbox.io/s/material-demo-1bzfj)):
```js
import React, { useState } from 'react'
import { MuiTriStateCheckbox } from 'mui-tri-state-checkbox'
export default function Demo() {
const [checked, setChecked] = useState(null)
return (
<>
Controlled (checked: {JSON.stringify(checked)})
setChecked(checked)}
/>
>
)
}
```
# Demo
Start the demo with `yarn start`. (To do: publish it to GitHub pages.)
# Contributing
Pull requests welcome!
# License
This project is free software, licensed under the terms of the [MIT license](/License).