Expand description
§Switch Component Module
This module provides a customizable toggle switch UI component for boolean state management in the Tessera UI framework.
The switch
component is commonly used for toggling settings or preferences in user interfaces, offering a modern,
animated on/off control. It supports both controlled (external state via SwitchState
) and uncontrolled usage
(via checked
and on_toggle
parameters), and allows for appearance customization such as track and thumb colors, size, and padding.
§Typical Usage
- Settings panels, feature toggles, or any scenario requiring a boolean on/off control.
- Can be integrated into forms or interactive UIs where immediate feedback and smooth animation are desired.
§Key Features
- Stateless component model: state is managed externally or via parameters, following Tessera’s architecture.
- Animation support for smooth transitions between checked and unchecked states.
- Highly customizable appearance and behavior via
SwitchArgs
. - Designed for ergonomic integration with the Tessera component tree and event system.
See SwitchArgs
, SwitchState
, and switch()
for details and usage examples.
Structs§
- Switch
Args - Arguments for configuring the
switch
component. - Switch
Args Builder - Builder for
SwitchArgs
. - Switch
State - Represents the state for the
switch
component, including checked status and animation progress.
Enums§
- Switch
Args Builder Error - Error type for SwitchArgsBuilder
Functions§
- switch
- A UI component that displays a toggle switch for boolean state.