We are currently in alpha version.
Please expect changes. If you find any issues, please report them on our github.
Toggle
Toggles are intuitive UI elements that allow users to switch between two states, such as on/off or enabled/disabled. They provide a clear, interactive way to control settings or preferences, enhancing user experience with immediate feedback and streamlined navigation.
Basic toggle
Increases battery life by 10%
html
Optional properties
Property | Type | Description |
---|---|---|
| string | Defines the id of the toggle. |
| string | Defines the label attached to the toggle. |
| string | Defines the help text attached to the toggle. |
| string | Provides the ability to set custom error messages. |
| string | Allows overriding default styles by passing Tailwind CSS classes. Utilize the |
Supported directives
Selector | Directive name | Description |
---|---|---|
| ZapLabelDirective | Import a directive |
| ZapFormFieldHelpTextDirective | Import a directive |
Example
Preview
Code
Switch between light and dark
Global configurations
A list of global styles, including shape, size, color, font sizes, font weights, and letter spacing can be provided via themeLibrary
in the provideZapOption
provider.. If you have multi theme setup, you can also provide theme specific colors. These apply to all default variants through out the app unless component level styles are provided.
Example
app.config.ts
Colors
You can provide each of these colors for different themes that you use
Property | Description |
---|---|
| Background color of the toggle. |
| Background color of the roller of the toggle. |
| Backgorund color of the toggle when on. |
| Backgorund color of the roller of the toggle when on. |
| Text color of the label. |
| Text color of the help text |
Other styles
You can provide a bunch of other styles, that are not theme based but rather generic
Property | Description |
---|---|
| Width of the toggle. |
| Height of the toggle. |
| Width of the roller of the toggle. |
| Height of the roller of the toggle. |
| Font size of the toggle's label. |
| Font weight of the toggle's label. |
| Line height of the toggle's label. |
| Letter spacing of the toggle's label. |
| Font size of the toggle's text. |
| Font weight of the toggle's text. |
| Line height of the toggle's text. |
| Letter spacing of the toggle's text. |
| Font size of the toggle's help text. |
| Font weight of the toggle's help text. |
| Line height of the toggle's help text. |
| Letter spacing of the toggle's help text. |