Skip to content

Commit 9374614

Browse files
docs(material/checkbox): updated docs and comments for default option value for checkbox (#21230) (#21254)
updates the documentation and comments of customizing the default option of the checkbox. the default option value to provide for checkbox is MAT_CHECKBOX_DEFAULT_OPTIONS for version>=10 fixes #21025 Co-authored-by: adhispace <[email protected]>
1 parent f568af1 commit 9374614

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/material-experimental/mdc-checkbox/testing/checkbox-harness.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class MatCheckboxHarness extends ComponentHarness {
112112
* action is complete.
113113
*
114114
* Note: This attempts to toggle the checkbox as a user would, by clicking it. Therefore if you
115-
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
115+
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
116116
* might not have the expected result.
117117
*/
118118
async toggle(): Promise<void> {
@@ -126,7 +126,7 @@ export class MatCheckboxHarness extends ComponentHarness {
126126
* complete.
127127
*
128128
* Note: This attempts to check the checkbox as a user would, by clicking it. Therefore if you
129-
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
129+
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
130130
* might not have the expected result.
131131
*/
132132
async check(): Promise<void> {
@@ -141,7 +141,7 @@ export class MatCheckboxHarness extends ComponentHarness {
141141
* complete.
142142
*
143143
* Note: This attempts to uncheck the checkbox as a user would, by clicking it. Therefore if you
144-
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
144+
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
145145
* might not have the expected result.
146146
*/
147147
async uncheck(): Promise<void> {

src/material/checkbox/checkbox.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ remove the indeterminate state.
2727
When user clicks on the `mat-checkbox`, the default behavior is toggle `checked` value and set
2828
`indeterminate` to `false`. This behavior can be customized by
2929
[providing a new value](https://angular.io/guide/dependency-injection)
30-
of `MAT_CHECKBOX_CLICK_ACTION` to the checkbox.
30+
of `MAT_CHECKBOX_DEFAULT_OPTIONS` to the checkbox.
3131

3232
```
3333
providers: [
34-
{provide: MAT_CHECKBOX_CLICK_ACTION, useValue: 'check'}
34+
{provide: MAT_CHECKBOX_DEFAULT_OPTIONS, useValue: { clickAction: 'noop' } as MatCheckboxDefaultOptions}
3535
]
3636
```
3737

src/material/checkbox/testing/checkbox-harness.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class MatCheckboxHarness extends ComponentHarness {
110110
* Toggles the checked state of the checkbox.
111111
*
112112
* Note: This attempts to toggle the checkbox as a user would, by clicking it. Therefore if you
113-
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
113+
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
114114
* might not have the expected result.
115115
*/
116116
async toggle(): Promise<void> {
@@ -122,7 +122,7 @@ export class MatCheckboxHarness extends ComponentHarness {
122122
* nothing if it is already checked.
123123
*
124124
* Note: This attempts to check the checkbox as a user would, by clicking it. Therefore if you
125-
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
125+
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
126126
* might not have the expected result.
127127
*/
128128
async check(): Promise<void> {
@@ -136,7 +136,7 @@ export class MatCheckboxHarness extends ComponentHarness {
136136
* nothing if it is already unchecked.
137137
*
138138
* Note: This attempts to uncheck the checkbox as a user would, by clicking it. Therefore if you
139-
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
139+
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
140140
* might not have the expected result.
141141
*/
142142
async uncheck(): Promise<void> {

0 commit comments

Comments
 (0)