Demos
For examples and details on the usage of this component, visit the component demo page:
Switch
Properties
| Parameter | Type | Description | Default |
|---|---|---|---|
| ThumbContent | RenderFragment<bool> |
Gets or sets the content to render within the thumb of the switch. | - |
| StartContent | RenderFragment |
Gets or sets the content to render at the start of the switch. | - |
| EndContent | RenderFragment |
Gets or sets the content to render at the end of the switch. | - |
| Classes | SwitchSlots |
Gets or sets the CSS class names for the switch slots. | - |
| ChildContent | RenderFragment |
Gets or sets content to be rendered inside the input. | - |
| Disabled | bool |
Gets or sets a value indicating whether the input is disabled. | false |
| ReadOnly | bool |
Gets or sets a value indicating whether the input is read-only. | false |
| Required | bool |
Gets or sets a value indicating whether the input is required. | false |
| Invalid | bool |
Gets or sets a value indicating whether the input is invalid. | false |
| Color | ThemeColor |
Gets or sets a color of the input. | Primary |
| Size | Size |
Gets or sets the size of the input. | Medium |
| Value | bool |
Gets or sets the value of the input. This should be used with two-way binding. | false |
| ValueChanged | EventCallback<bool> |
Gets or sets a callback that is fired when the value of the input changes. | - |
| OnFocus | EventCallback<FocusEventArgs> |
Gets or sets a callback that is fired when the input receives focus. | - |
| OnBlur | EventCallback<FocusEventArgs> |
Gets or sets a callback that is fired when the input loses focus. | - |
| ValueExpression | Expression<Func<bool>> |
Gets or sets an expression that identifies the bound value. | - |
| As | string |
Gets or sets an HTML tag of the component. | - |
| Class | string |
Gets or sets CSS class names that will be applied to the component. | - |
| Style | string |
Gets or sets styles that will be applied to the component. | - |
| AdditionalAttributes | IReadOnlyDictionary<string, object> |
Gets or sets a collection of additional attributes that will be applied to the component. | - |
| ElementReference | ElementReference? |
Gets or sets the associated . May be if accessed before the component is rendered. | - |