mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
docs(all): possible values are extracted by stencil (#16190)
* docs(all): possible values are extracted by stencil * add defaults * remove all hardcoded defaults * update stencil
This commit is contained in:
@ -9,24 +9,24 @@ Toggles change the state of a single option. Toggles can be switched on or off b
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Attribute | Description | Type |
|
||||
| ---------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
|
||||
| `checked` | `checked` | If `true`, the toggle is selected. Defaults to `false`. | `boolean` |
|
||||
| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `string \| undefined` |
|
||||
| `disabled` | `disabled` | If `true`, the user cannot interact with the toggle. Defaults to `false`. | `boolean` |
|
||||
| `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `"ios" \| "md"` |
|
||||
| `name` | `name` | The name of the control, which is submitted with the form data. | `string` |
|
||||
| `value` | `value` | The value of the toggle does not mean if it's checked or not, use the `checked` property for that. The value of a toggle is analogous to the value of a `<input type="checkbox">`, it's only used when the toggle participates in a native `<form>`. Defaults to `on`. | `null \| string \| undefined` |
|
||||
| Property | Attribute | Description | Type | Default |
|
||||
| ---------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | -------------- |
|
||||
| `checked` | `checked` | If `true`, the toggle is selected. | `boolean` | `false` |
|
||||
| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `string \| undefined` | `undefined` |
|
||||
| `disabled` | `disabled` | If `true`, the user cannot interact with the toggle. | `boolean` | `false` |
|
||||
| `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` |
|
||||
| `name` | `name` | The name of the control, which is submitted with the form data. | `string` | `this.inputId` |
|
||||
| `value` | `value` | The value of the toggle does not mean if it's checked or not, use the `checked` property for that. The value of a toggle is analogous to the value of a `<input type="checkbox">`, it's only used when the toggle participates in a native `<form>`. | `null \| string \| undefined` | `'on'` |
|
||||
|
||||
|
||||
## Events
|
||||
|
||||
| Event | Detail | Description |
|
||||
| ----------- | ----------------------- | -------------------------------------------- |
|
||||
| `ionBlur` | | Emitted when the toggle loses focus. |
|
||||
| `ionChange` | CheckedInputChangeEvent | Emitted when the value property has changed. |
|
||||
| `ionFocus` | | Emitted when the toggle has focus. |
|
||||
| `ionStyle` | StyleEvent | Emitted when the styles change. |
|
||||
| Event | Description | Detail |
|
||||
| ----------- | -------------------------------------------- | ----------------------- |
|
||||
| `ionBlur` | Emitted when the toggle loses focus. | void |
|
||||
| `ionChange` | Emitted when the value property has changed. | CheckedInputChangeEvent |
|
||||
| `ionFocus` | Emitted when the toggle has focus. | void |
|
||||
| `ionStyle` | Emitted when the styles change. | StyleEvent |
|
||||
|
||||
|
||||
## CSS Custom Properties
|
||||
|
@ -29,7 +29,6 @@ export class Toggle implements ComponentInterface {
|
||||
|
||||
/**
|
||||
* The mode determines which platform styles to use.
|
||||
* Possible values are: `"ios"` or `"md"`.
|
||||
*/
|
||||
@Prop() mode!: Mode;
|
||||
|
||||
@ -46,12 +45,12 @@ export class Toggle implements ComponentInterface {
|
||||
@Prop() name: string = this.inputId;
|
||||
|
||||
/**
|
||||
* If `true`, the toggle is selected. Defaults to `false`.
|
||||
* If `true`, the toggle is selected.
|
||||
*/
|
||||
@Prop({ mutable: true }) checked = false;
|
||||
|
||||
/**
|
||||
* If `true`, the user cannot interact with the toggle. Defaults to `false`.
|
||||
* If `true`, the user cannot interact with the toggle.
|
||||
*/
|
||||
@Prop() disabled = false;
|
||||
|
||||
@ -61,7 +60,6 @@ export class Toggle implements ComponentInterface {
|
||||
*
|
||||
* The value of a toggle is analogous to the value of a `<input type="checkbox">`,
|
||||
* it's only used when the toggle participates in a native `<form>`.
|
||||
* Defaults to `on`.
|
||||
*/
|
||||
@Prop() value?: string | null = 'on';
|
||||
|
||||
|
Reference in New Issue
Block a user