Appearance
The Switch provides a predefined set of appearance options.
Apart from the default vision of the Switch, these alternative styling options enable you to configure each individual aspect of the component's appearance.
The current article provides details about how the component changes when the different configurations of its properties are applied. Here are the sections you can directly access:
Configurator demo
The following example demonstrates configuring different aspects of a Switch appearance through a configurator.
Size
The size of the Switch is controlled through its size property. The values we can pass to the property are as follows:
small— Sets thepaddingto2pxand8px.medium(Default) — Sets thepaddingto4pxand8px.large— Sets thepaddingto6pxand8px.null— Passingnullto thesizeproperty gives us the option to define acustom CSS classthat sets thepaddingof the Switch.
The following example demonstrates the usage of each size option:
Track roundness
The track roundness of the Switch is controlled through its trackRounded property. The values we can pass to the property are as follows:
small— Sets theborder radiusto1px.medium(Default) — Sets theborder radiusto2px.
large— Sets theborder radiusto4px.
full— Sets theborder radiusto9999px.null— Passingnullto thetrackRoundedproperty gives us the option to define acustom CSS classthat defines theborder-radiusof the Switch track.
The following example demonstrates the usage of each trackRounded option:
Thumb roundness
The thumb roundness of the Switch is controlled through its thumbRounded property. The values we can pass to the property are as follows:
small— Sets theborder radiusto1px.medium(Default) — Sets theborder radiusto2px.
large— Sets theborder radiusto4px.
full— Sets theborder radiusto9999px.null— Passingnullto thethumbRoundedproperty gives us the option to define acustom CSS classthat defines theborder-radiusof the Switch thumb.
The following example demonstrates the usage of each thumbRounded option: