Generic selectors

Exact matches only

Search in title

Search in content

Post Type Selectors

Switch

A switch is a versatile toggle control for switching between two states seamlessly.

  • Overview
  • Specs
  • Guidelines

Component

Used to navigate between tabs, filter content or activate/deactivate functionalities. Switches can be either clicked or dragged to change their value.

They allow intuitive and quick interaction, improving the user experience by customizing the content to their preferences or needs.

Switch_Anatomy
Switch anatomy

A: Non active variation

B: Active variation

1: Label

2: Switch

3: Icon

Ekon_Switches
Switches in user configurations

Used for:

Binary options

When presenting users with simple binary choices, such as on/off, active/inactive, enable/disable, switches offer a clear and intuitive way to indicate and control these states;

Settings and preferences

Switches are commonly used for toggling settings or preferences, allowing users to customize their experience by turning features on or off;

Consistency

Switches offer a consistent visual pattern for indicating and controlling binary options across different parts of an interface;

Mobile-friendly

With the rise of mobile devices, switches are particularly suitable for touch interfaces, as they offer a large, tappable area for users to interact with;

Real-time updates

Switches can trigger real-time updates or actions in the interface, providing immediate feedback to users.

Don’t use for:

Complex multi-state options

When options require more than two states or are not binary choices, switches may not be suitable. Consider using checkboxes or drop-downs;

Ambiguity in meaning

If the meaning of the switch state is ambiguous or subject to interpretation, it can lead to user confusion;

Inappropriate context

In contexts where switches are not intuitive or appropriate for the action being performed, it’s best to use alternative controls. For example, in a form where users are selecting from a range of options rather than toggling an on/off state. Consider using radio buttons in this case;

Overuse of switches

Avoid overloading the page with unnecessary switches, keeping them only when they provide clear value for the user experience.

Switch_Form
Switch misapplied as a checkbox


Demo

Access the Figma file and inspect element using Dev Mode.

Switch_Figma
Switch at Figma

Last Update

Older_Switch
Old version of the switch
Switch_Current
Current version of the switch
  • Updated overall switch design;
  • Added large variable;
  • Updated label typography;

Related

Button Group

Group of selection options in button format which can be multiple or single selection …

States

Switch_Specs
Switch

Not Active

Enabled
.enabled {
  border-color: var(--grey-5);
  background-color: var(--grey-4); 
  color: var(--grey-8);
  label-color: var(--grey-8);
}
Hover
.hover {
  border-color: var(--grey-6);
  background-color: var(--theme-10); 
  color: var(--grey-9);
  label-color: var(--grey-9);
}
Pressed
.pressed {
  border-color: var(--theme-100);
  background-color: var(--theme-10); 
  color: var(--grey-9);
  label-color: var(--grey-9);
}
Disabled
.pressed {
  border-color: var(--grey-4);
  background-color: var(--grey-2); 
  color: var(--grey-6);
  icon-color: var(--grey-6);
  label-color: var(--grey-6);
}
Focus
.focus {
  border-color: var(--grey-9);
  background-color: var(--grey-4); 
  color: var(--grey-8);
  label-color: var(--grey-9);
}

Active

Enabled
.enabled {
  border-color: var(--theme-40);
  background-color: var(--theme-10); 
  color: var(--theme-100);
  icon-color: var(--grey-1);
  label-color: var(--grey-9);
}
Hover
.hover {
  border-color: var(--theme-80);
  background-color: var(--theme-10); 
  color: var(--theme-highlight);
  icon-color: var(--grey-1);
  label-color: var(--grey-9);
}
Pressed
.pressed {
  border-color: var(--theme-highlight);
  background-color: var(--theme-10); 
  color: var(--theme-highlight);
  icon-color: var(--grey-1);
  label-color: var(--grey-9);
}
Disabled
.disabled {
  border-color: var(--grey-4);
  background-color: var(--grey-2); 
  color: var(--theme-60);
  icon-color: var(--grey-6);
  label-color: var(--grey-6);
}
Focus
.focus {
  border-color: var(--theme-highlight);
  background-color: var(--theme-10); 
  color: var(--theme-100);
  icon-color: var(--grey-1);
  label-color: var(--grey-9);
}

Size

Small
.small {
  gap: var(--spacing-8);
  border-radius: var(--rounded);
  icon: icon: 12px;
  label: var(--Label-small);
  }
Regular
.regular {
  gap: var(--spacing-8);
  border-radius: var(--rounded);
  icon: icon: 16px;
  label: var(--Label-regular);
  }
Large
.large {
  gap: var(--spacing-12);
  border-radius: var(--rounded);
  icon: icon: 20px;
  label: var(--Label-large);
  }

Useful links

guidelines figma accent icon

Consult our Figma file to access our assets and inspect them in dev mode.

polygon-framework

This component is or will be provided by the Polygon framework. See its documentation to learn more.

This element is in line with the guidelines of the CDS (Cegid Design System). Find out more.

Behavior

Switch Status

The switch toggles between the disabled state and the active state with a click or an enter (when in Focus state).

The entire switch area, including the label, is clickable.

In the disabled state, the switch does not allow switching between states.

Switch_States
Switch changing its state


2_Lines_Switch

When a label is too long for the available space, a second line of text should be created.

Destructive_Action_Switch

To avoid accidental errors, do not use the switch for irreversible or critical actions without additional confirmation from the user.

Opposite_Actions_Switch

Avoid using switches to control opposing options.


Case Studies

Accessible Web for Everyone

Declaração de Acessibilidade do Compose Design

O Compose Design é gerido pela equipa Experience Architecture da Cegid e foi desenvolvido para ser utilizado pelo maior número …
Why Web Accessibility Matters - And How to Start

Why Web Accessibility Matters – And How to Start

Web accessibility is about designing inclusive digital experiences that benefit everyone, guided by four key principles and driven by the …
Writing for Everyone

Writing for Everyone: Every Word Counts in Accessibility

Writing for everyone is an essential part of any digital product. It can and does make a big difference to …

Outline