@rmwc/checkbox
Advanced tools
Comparing version 14.0.4 to 14.0.5
{ | ||
"name": "@rmwc/checkbox", | ||
"version": "14.0.4", | ||
"version": "14.0.5", | ||
"description": "RMWC Checkbox component", | ||
@@ -40,4 +40,2 @@ "main": "./index.js", | ||
"peerDependencies": { | ||
"@material/checkbox": "^14.0.0", | ||
"@material/form-field": "^14.0.0", | ||
"react": ">=16.8.x", | ||
@@ -47,8 +45,10 @@ "react-dom": ">=16.8.x" | ||
"dependencies": { | ||
"@rmwc/base": "14.0.4", | ||
"@rmwc/formfield": "14.0.4", | ||
"@rmwc/ripple": "14.0.4", | ||
"@rmwc/toggleable": "14.0.4", | ||
"@rmwc/types": "14.0.4" | ||
"@material/checkbox": "^14.0.0", | ||
"@material/form-field": "^14.0.0", | ||
"@rmwc/base": "14.0.5", | ||
"@rmwc/formfield": "14.0.5", | ||
"@rmwc/ripple": "14.0.5", | ||
"@rmwc/toggleable": "14.0.5", | ||
"@rmwc/types": "14.0.5" | ||
} | ||
} |
# Checkboxes | ||
> Checkboxes allow the user to select multiple options from a set. | ||
Checkboxes allow the user to select multiple options from a set. | ||
@@ -8,71 +8,57 @@ - Module **@rmwc/checkbox** | ||
- Using CSS Loader | ||
- import **'@rmwc/checkbox/styles';** | ||
- import '@rmwc/checkbox/styles'; | ||
- Or include stylesheets | ||
- **'@material/checkbox/dist/mdc.checkbox.css'**; | ||
- **'@material/form-field/dist/mdc.form-field.css'**; | ||
- **'@material/ripple/dist/mdc.ripple.css'**; | ||
- **'@material/checkbox/dist/mdc.checkbox.css'** | ||
- **'@material/form-field/dist/mdc.form-field.css'** | ||
- **'@material/ripple/dist/mdc.ripple.css'** | ||
- MDC Docs: [https://material.io/develop/web/components/input-controls/checkboxes/](https://material.io/develop/web/components/input-controls/checkboxes/) | ||
Controlled | ||
```js | ||
```jsx | ||
function Example() { | ||
const \[checked, setChecked\] \= React.useState(false); | ||
const [checked, setChecked] = React.useState(false); | ||
return ( | ||
<Checkbox | ||
label\="Cookies" | ||
checked\={checked} | ||
onChange\={(evt) \=> setChecked(!!evt.currentTarget.checked)} | ||
label="Cookies" | ||
checked={checked} | ||
onChange={(evt) => setChecked(!!evt.currentTarget.checked)} | ||
/> | ||
); | ||
} | ||
``` | ||
```jsx | ||
<Checkbox label="Pizza" /> | ||
``` | ||
Uncontrolled | ||
```js | ||
<Checkbox label\="Pizza" /> | ||
```jsx | ||
<Checkbox>Icecream</Checkbox> | ||
``` | ||
Label as Child | ||
```jsx | ||
<> | ||
<Checkbox label="Broccoli" indeterminate /> | ||
```js | ||
<Checkbox\>Icecream</Checkbox\> | ||
<Checkbox label="Always On" checked /> | ||
<Checkbox label="Always Off" checked={false} /> | ||
</> | ||
``` | ||
States | ||
## Checkbox | ||
A Checkbox component. | ||
```js | ||
### Props | ||
<\> | ||
| Name | Type | Description | | ||
|------|------|-------------| | ||
| `checked` | `boolean` | Toggle the control on and off. | | ||
| `disabled` | `boolean` | Disables the control. | | ||
| `foundationRef` | `Ref<MDCCheckboxFoundation<>>` | Advanced: A reference to the MDCFoundation. | | ||
| `id` | `string` | A DOM ID for the toggle. | | ||
| `indeterminate` | `boolean` | Make the control indeterminate | | ||
| `inputRef` | `Ref<HTMLInputElement<>>` | A reference to the native input. | | ||
| `label` | `ReactNode` | A label for the control. | | ||
| `ripple` | `RipplePropT` | Adds a ripple effect to the component | | ||
| `rootProps` | `HTMLProps<any>` | By default, all props except className and style spread to the input. These are additional props for the root of the checkbox. | | ||
| `value` | `string \| number \| string[]` | The value of the control. | | ||
<Checkbox label\="Broccoli" indeterminate /> | ||
<Checkbox label\="Always On" checked /> | ||
<Checkbox label\="Always Off" checked\={false} /> | ||
</\> | ||
``` | ||
## Checkbox |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11390
64
+ Added@material/checkbox@^14.0.0
+ Added@material/form-field@^14.0.0
+ Added@rmwc/base@14.0.5(transitive)
+ Added@rmwc/formfield@14.0.5(transitive)
+ Added@rmwc/provider@14.0.5(transitive)
+ Added@rmwc/ripple@14.0.5(transitive)
+ Added@rmwc/toggleable@14.0.5(transitive)
+ Added@rmwc/types@14.0.5(transitive)
- Removed@rmwc/base@14.0.4(transitive)
- Removed@rmwc/formfield@14.0.4(transitive)
- Removed@rmwc/provider@14.0.4(transitive)
- Removed@rmwc/ripple@14.0.4(transitive)
- Removed@rmwc/toggleable@14.0.4(transitive)
- Removed@rmwc/types@14.0.4(transitive)
Updated@rmwc/base@14.0.5
Updated@rmwc/formfield@14.0.5
Updated@rmwc/ripple@14.0.5
Updated@rmwc/toggleable@14.0.5
Updated@rmwc/types@14.0.5