<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGSQD2L" height="0" width="0" style="display:none;visibility:hidden" title="GTM"></iframe>

Modes

Modes utilize alternate values in SWAN tokens to adjust the appearance of UI. Modes cascade through to all tokens and components used within the mode. SWAN currently supports three modes: Standard mode (default), Dark mode, and Compact mode.

Standard mode

The default mode used when no other modes are specified. Use for standard e-commerce experiences, landing pages, and blog posts. Examples may include Homepage, Category page, and Gallery.

Dark mode

Provides a reversed appearance of color in the UI, enabling components to be accessible on darker backgrounds.

Info:

Dark mode has been designed to be used in sections of the UI as opposed to entire pages or experiences.

Most semantic colors have differing values in each mode to provide appropriate contrast against the background. Provided you're using semantic colors, these values will change automatically depending on the mode being used.

Enable Dark mode via the core prop darkMode.

Compact mode

Compact mode reduces the scale of typography and space tokens to allow more information and actions to be shown. Unlike Standard mode, Compact mode has no media values, which means it has a consistent size across all breakpoints.

Info:

Compact mode has been designed to use at the page-level rather than for individual components or sections of a page.

Use for workspace-type experiences. Examples may include Studio, Logomaker, and the Collaboration app. It also may be a candidate for internal Vista tools where content density is important.

Enable Compact mode via the core prop compactMode.

Warning:

Note: When nesting Dark mode inside Compact mode, Compact mode must be re-set. This is a known issue that we will address in a future version.

Using modes

Developers

Modes can be activated through their respective core prop, e.g. darkMode. Different modes can be used together as needed, e.g. darkMode and compactMode. Modes can also be nested. To reset to the default token values, standardMode can be applied to overwrite all other modes.

The preview has been updated.

Designers

In Figma, modes are provided via variables in the SWAN UI Kit. They can be applied via the Layers panel—select a top-level frame, and choose the mode you wish to apply.

Was this page useful?

Thanks for your feedback!

Feel free to include your name if you wish to have a follow up conversation.


Published: Sep 2, 2024Last updated: Sep 4, 2024