3.0.0 • Published 5 years ago
@arterial/checkbox v3.0.0
Arterial Checkbox
Another React Material Checkbox
Installation
npm install @arterial/checkboxUsage
Styles
Sass
@use "@material/checkbox/index.scss" as checkbox;
@include checkbox.core-styles;CSS
import '@material/checkbox/dist/mdc.checkbox.css';JSX
import {Checkbox} from '@arterial/checkbox';Checked Checkbox
function Checked() {
const [checked, setChecked] = useState(true);
return (
<Checkbox
checked={checked}
id="checkbox-checked"
onChange={e => setChecked(e.target.checked)}
/>
);
}Unchecked Checkbox
function Unchecked() {
const [checked, setChecked] = useState(false);
return (
<Checkbox
checked={checked}
id="checkbox-unchecked"
onChange={e => setChecked(e.target.checked)}
/>
);
}Indeterminate Checkbox
function Indeterminate() {
const [checked, setChecked] = useState(false);
const [indeterminate, setIndeterminate] = useState(true);
return (
<Checkbox
checked={checked}
id="checkbox-indeterminate"
indeterminate={indeterminate}
onChange={e => {
setChecked(e.target.checked);
setIndeterminate(e.target.indeterminate);
}}
/>
);
}Other Variants
Label
function Label() {
const [checked, setChecked] = useState(true);
return (
<Checkbox
checked={checked}
id="checkbox-label"
label="Checkbox"
onChange={e => setChecked(e.target.checked)}
/>
);
}Align End
function AlignEnd() {
const [checked, setChecked] = useState(true);
return (
<Checkbox
alignEnd
checked={checked}
id="checkbox-align-end"
label="Checkbox"
onChange={e => setChecked(e.target.checked)}
/>
);
}Disabled
<Checkbox
disabled
id="checkbox-disabled"
label="Checkbox"
onChange={() => {}}
/>Props
Checkbox
| Name | Type | Description |
|---|---|---|
| alignEnd | boolean | Aligns root element on the right side of the label. |
| checked | boolean | Indicates whether the element is checked. |
| className | string | Classes to be applied to the root element. |
| disabled | boolean | Indicates whether the element is disabled. |
| id | string | Id of the element. |
| indeterminate | bool | Indicates whether the checkbox is indeterminate. |
| label | string | Text to be displayed next to the root element. |
| onChange | function | Change event handler. |
| ripple | boolean | Enables ripple within root element. Defaults to true. |
| style | object | Styles to be applied to the root element. |
| value | string | Value of input. |
3.0.0
5 years ago
2.0.3
5 years ago
2.0.2
5 years ago
2.0.1
5 years ago
2.0.0
5 years ago
1.2.0
5 years ago
1.1.0
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago
1.0.0-alpha.6
5 years ago
1.0.0-alpha.5
5 years ago
1.0.0-alpha.4
5 years ago
1.0.0-alpha.3
5 years ago
1.0.0-alpha.0
6 years ago