Toggle
Components
>
Editing Data
>
Toggle
Use this component to...
Allow the user to change a Boolean value
See this component in action...
Overview
Use the toggle component to allow the user to change a Boolean value.
The toggle acts like a physical switch that allows users to turn things on or off, like a light switch.
If a label is specified, it displays to the right of the toggle.
Development
Web component development
Component reference
rui-toggle
rui-toggle
Module: rui-input
-
Package: @jkhy/responsive-ui-wc
Allows the user to change a Boolean value
Name | Type | Default | Description |
---|---|---|---|
value | boolean | false | Bind this property to a backing value in your controller to set the initial value for the toggle. |
rui-value-change | event | This event fires when the toggle’s value changes. The new value is passed in the event detail. Use this event to update the backing value in your controller. | |
labelText | string | '' | If the toggle needs to be labeled, specify its label text with this property. |
isDisabled | boolean | false | Specifies whether the toggle is disabled. |
Implementation
Begin by importing the rui-input
module into your application.
// import into app.module
import '@jkhy/responsive-ui-wc/components/rui-input/rui-input-imports';
Example:
<rui-toggle labelText="Show Passwords" [value]="showPasswords" (rui-value-change)="showPasswords = $event.detail"></rui-toggle>
Angular wrapper development
Wrapper reference
jha-toggle
jha-toggle
Module: JhaToggleModule
-
Package: @jkhy/responsive-ui-angular
Allows the user to change a Boolean value
Name | Type | Default | Description |
---|---|---|---|
jhaToggleVal | boolean | false | If the toggle is part of a template-driven form, two-way bind this property to a backing value. |
jhaLabel | string | '' | If the toggle needs to be labeled, specify its label text with this property. |
jhaIsDisabled | boolean | false | Specifies whether the toggle is disabled. |
jhaToggleValChange | event | This event fires when the toggle’s value changes. | |
jhaIsReactive | boolean | false | This property is deprecated and will be removed in a future release. |
Implementation
Begin by importing the JhaToggleModule
module into your application.
// import into app.module
import { JhaToggleModule } from '@jkhy/responsive-ui-angular/jha-toggle';
@NgModule({
imports: [
...
JhaToggleModule,
...
]
})
export class AppModule(){}
Reactive form example:
<jha-toggle id="showPasswords" formControlName="showPasswords"></jha-toggle>
Template driven form example:
<jha-toggle id="showPasswords" [(jhaToggleVal)]="showPasswords"></jha-toggle>
Design
Figma design
Figma design info
Dev Component | Design Component Name |
---|---|
Toggle | RUI / Buttons / Toggle Switch on the Checked property if the toggle is on. |
Adobe XD design
Adobe XD design info
- Sample App - Buttons
Dev Component | Design Component Name |
---|---|
Toggle - on | JHA / Buttons / Toggle / On |
Toggle - off | JHA / Buttons / Toggle / Off |
Support options
Last updated Mon Nov 27 2023