Foundation - Switch SASS Reference



Description

You can change the styles of the components by using SASS Reference.

Variables

The following table lists the SASS variables in project's settings file that makes this component's default styles to get customized.

Sr.No. Name & Description Type Default Value
1

$switch-background

It represents background color of a switch.

Color $medium-gray
2

$switch-background-active

It represents the switch's background active color.

Color $primary-color
3

$switch-height

It represents the switch's height, without any class applied.

Number 2rem
4

$switch-height-tiny

It represents the switch's height with .tiny class.

Number 1.5rem
5

$switch-height-small

It represents the switch's height with .small class.

Number 1.75rem
6

$switch-height-large

It represents the switch's height with .large class.

Number 2.5rem
7

$switch-radius

It represents switch's border radius.

Number $global-radius
8

$switch-margin

It represents border around a modal.

Number $global-margin
9

$switch-paddle-background

It represents background color for switch container and paddle.

Color $white
10

$switch-paddle-offset

It represents the spacing between edge of the body and switch paddle.

Number 0.25rem
11

$switch-paddle-radius

It represents the switch paddle's border radius.

Number $global-radius
12

$switch-paddle-transition

It represents switch transition.

Number all 0.25s ease-out

Mixins

To build this component's final CSS output, the following mixins can be used. To build your own class structure using Foundation components, you can use the mixins yourself.

switch-container

@include switch-container;

It adds switch container's styles. Apply it to a container class.

switch-input

@include switch-input;

It adds switch input styles. Within a switch you have to apply it to an <input>.

switch-paddle

@include switch-paddle;

It adds styles for paddle and background of a switch. Within a switch you have to apply it to a <label>.

switch-text

@include switch-text;

Within a switch, it adds base styles for active or inactive text. You have to apply this to text elements within <label>.

switch-text-active

@include switch-text-active;

It adds styles for switch's active state text.

switch-text-inactive

@include switch-text-inactive;

It adds styles for switch's inactive state text.

switch-size

@include switch-size($font-size, $width, $height, $paddle-width, $paddle-offset);

By changing the size of the body and paddle, the switch-size alters the switch's size. You have to apply this to a container of the switch.

The following table lists the parameters that switch-size accepts.

Sr.No. Parameter & Description Type Default Value
1

$font-size

It represents the label's font size inside the switch.

Number 1rem
2

$width

It represents width of the switch body.

Number 4rem
3

$height

It represents height of the switch body.

Number 2rem
4

$paddle-width

It represents width of the switch paddle.

Number 1.5rem
5

$paddle-width

It represents the spacing between the edge of the switch body and switch paddle.

Number 0.25rem
foundation_basic_controls.htm
Advertisements