# Themes and Control Variants

A **theme** consists of all the styling defaults that your application can call upon. A theme is made up of:

* **Variables** - define default color, size, font, and time values
* **Control Variants** - define sets of styling properties for specific Web Controls, like CSS classes

You can only ever have one theme tied to your application at any one time, though it can be useful to name themes when exporting them from and importing them to other applications, as this can help you keep track of precisely which theme you're working with at any given time. For more on importing and exporting themes, see [Importing and Exporting Themes](themes-and-control-variants/importing-and-exporting-themes).

Styling changes can be made in both the [Web Flows Builder](../../studio/studio/builder-bar/web-flows-builder) and the [Theme Builder](../../studio/studio/builder-bar/theme-builder). While the Theme Builder provides a convenient single place to view and edit all of a theme's components, changes and additions to Control Variants are typically made directly in the Web Builder.

![](https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-7706382313068a333c8652e608331f5f3779b15c%2Fthemes-and-control-variants-v184-0.png?alt=media)

## Control Variants

A Control Variant is a set of styling properties for a specific control, similar to a class in CSS.

Every Web Control has associated Variants: cosmetic variations that appear differently but function identically. Variants are defined in the Theme Builder and used as defaults when stying Web Controls. For instance, within a single application, you might create two Variants of Button: a rectangular one in red, and a round one in blue. Any changes made to existing Variants also apply retroactively: existing Web Controls previously styled according to the old default will immediately take the form specified by the new default. This allows for consistent styling throughout the entirety of each application, and it also allows you to test how how different combinations of colors, fonts, and graphics look together before committing to an implementation.

Most Web Controls come out-of-the-box with at least a few pre-configured Variants. For instance, the Button Web Control has four: `default`, `buttonSecondary`, `buttonText`, and `link`:

![](https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-0f7d262912d2fd5019888b8c01162d5d3b99c5c4%2Fthemes-and-control-variants-v184-1.png?alt=media)

Once a Web Control has been added to a Web Page, you can change the Variant that defines its appearance by Inspecting the Web Control and selecting a Variant from the dropdown menu under **Variant** in the **Style** Tab.

### Modifying Existing Variants

#### Modifying Existing Variants from the Web Flows Builder

Once a Web Control has been added to a Web Page, you can change the styling properties of the Web Control by Inspecting it and making changes to a selected Variant by modifying the [styling properties](web-control-styling-properties) under the **Style** Tab. **By default, these changes will be applied only to the individual instance being Inspected.** However, once your changes are finalized, you can use them to update the selected Variant. This will apply your changes to all instances of the selected Variant throughout your application. To do so, click on the "..." icon to the right of the selected Variant under **Style > Variant** and then select "Update Theme Variant" from the menu that appears.

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-1cc8c4aec54cba3db767a9514ea13079e2b3638a%2Fthemes-and-control-variants-v184-2.png?alt=media" alt="" width="400"><figcaption></figcaption></figure>

Alternatively, if you find you do not like the changes you have made and would like to revert the styling properties of the selected Web Control back to the Variant's initial defaults, you can select "Reset All Overrides".

#### Modifying Existing Variants in the Theme Builder

If you want to edit an existing Variant from the Theme Builder, you can toggle directly over to the Theme Builder using the Builder Bar. Alternatively, if you are already Inspecting the relevant Web Control in the Web Flows Builder, you can open the selected Variant in the Theme Builder for modification by clicking on the "..." icon to the right of the selected Variant under **Style > Variant** and then selecting "Edit in Theme Builder" from the menu that appears.

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-7c4a2b35d2ed38276aa3882f9b55ffc60bcae08a%2Fthemes-and-control-variants-v184-3.png?alt=media" alt="" width="400"><figcaption></figcaption></figure>

Upon Inspecting a Variant in the Theme Builder, changes to that Variant's appearance can be modified using the usual [Web Control Styling Properties](web-control-styling-properties).

Any changes made to a Variant in this way will be immediately reflected throughout your application.

### Adding New Variants

#### Adding new Variants from the Web Flows Builder

When working with Web Controls in the Web Flows Builder, it is possible to style the individual properties of an individual Web Control by making changes to the style fields found under the **Style** Tab of the Inspector. If you do not want to use these changes to redefine the base Variant (see above), it is often a good idea to save these styling configurations as a new Variant so that they can be reused.

To save the styling configurations you've used to style an individual Web Control, click on the "..." icon to the right of the selected Variant under **Style > Variant** and then select "Create Theme Variant" from the menu that appears:

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-3a4639eec42c194672d55d98bd7095c7485ad597%2Fthemes-and-control-variants-v184-4.png?alt=media" alt="" width="400"><figcaption></figcaption></figure>

This will open up a pop-up window, so that you can rename your new Variant something more intuitive. Once you have done so and clicked the **Create** Button, your new Variant will be available to reference throughout your application.

#### Adding new Variants in the Theme Builder

To add a new Variant without seeing how it looks in directly in your application flow first, you can toggle over to the Theme Builder, click on the '+' icon to the right of the **Theme** branch in the Tree, and then select the relevant Web Control from the select menu that appears:

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-21d32f4beba8070691834d7eaceca8c24c3734de%2Fthemes-and-control-variants-v184-5.png?alt=media" alt="" width="400"><figcaption></figcaption></figure>

This will add a new Variant to the selected Web Control. Expanding the relevant Web Control in the Tree will reveal the newly-created Variant:

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-ef88a75c60bcb2b03fbc314a0889490d3c2be440%2Fthemes-and-control-variants-v184-6.png?alt=media" alt="" width="300"><figcaption></figcaption></figure>

Out-of-the-box, this new Variant will be a duplicate of the primary default Variant. In the above example, for instance, the newly-created Button Variant was created with the designation `default-copy` and had the same initial styling configurations as `default`. It will not be, however, coupled with the `default` Variant. Changes made to `default-copy` will not impact `default`.

The name of a Variant can be changed by double-clicking on it in the Tree. Upon Inspecting a Variant in the Theme Builder, changes to that Variant's appearance can be modified using the usual [Web Control Styling Properties](web-control-styling-properties).

**Using a specific existing Variant as the base for a new Variant**

When a new Variant is created by clicking on the '+' to the right of the **Theme** branch, as discussed above, the primary default will automatically be used as a base for the new Variant. It is also possible to use another existing Variant as the foundation of your new Variant.

To duplicate an existing Variant in the Theme Builder, select the **Duplicate** icon to the right of the desired Variant in the Tree. The following example, for instance, shows how to duplicate the Variant `buttonSecondary`:

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-6c734aa07ed9195a66774f582bb70deb2923e89b%2Fthemes-and-control-variants-v184-7.png?alt=media" alt="" width="300"><figcaption></figcaption></figure>

This will create a new Button Variant named `buttonSecondary-copy`, which will have the same initial styling configurations as `buttonSecondary`. It will not be, however, coupled with the `buttonSecondary` Variant. Changes made to `buttonSecondary-copy` will not impact `buttonSecondary`.

The name of a Variant can be changed by double-clicking on it in the Tree. Upon Inspecting a Variant in the Theme Builder, changes to that Variant's appearance can be modified using the usual [Web Control Styling Properties](web-control-styling-properties).

## Variables

Variables define colors, sizes, fonts, and units of time that can be modified at once and reused. In addition to being available while creating UI in the Web Flows Builder, they are also often used to define Control Variants. For instance, the color defined by `brandPrimary` is used automatically to define the background color of the default Button Variant:

![](https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-7896834070acc833389a4f516b6471db988ae7f0%2Fthemes-and-control-variants-v184-8.png?alt=media)

Any changes made to `brandPrimary` will be reflected in the default Button Variant.

To modify an existing variable, select it in the Stage and apply modifications in the Inspector. Changes made to a variable will be immediately reflected throughout the Studio.

### Making new Variables

While the Theme Builder comes out-of-the-box with several variables that can be modified, it is also possible to make your own. This allows you to do things like keep track of a more detailed color palette, juggle multiple proprietary fonts, and store additional units of time that you might want to reuse in different kinds of [Animations](web-control-styling-properties/animations).

To create a new variable, click on the **Add Default** box in the Stage:

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-2ef8979705419f18029c663fe26b1d4c3a4d8c79%2Fthemes-and-control-variants-v184-9.png?alt=media" alt="" width="300"><figcaption></figcaption></figure>

This will open a new variable for modification in the Inspector. To rename the variable, select the field that appears at the top of the Inspector:

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-2aea70983e1a8eaadfac3c955d7647d05dd5cda5%2Fthemes-and-control-variants-v184-10.png?alt=media" alt="" width="400"><figcaption></figcaption></figure>

To delete a variable, click on the '-' icon to the top of the Stage and select **Delete Selected Variable** from the dropdown menu that appears:

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-4545e899559920b1c0d0093055ebed55b73df079%2Fthemes-and-control-variants-v184-11.png?alt=media" alt="" width="400"><figcaption></figcaption></figure>

### Managing Tags

Tagging variables makes them appear at the top of selection menus as relevant. For instance, out of the box, `backgroundPrimary` and `backgroundSecondary` come tagged as **Background Color**. As a consequence, note how they appear in the selection menu while selecting a background color:

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-b8afc03834717823f23e654a48cd6ef69b79d0e2%2Fthemes-and-control-variants-v184-12.png?alt=media" alt="" width="300"><figcaption></figcaption></figure>

Compare this to where `backgroundPrimary` and `backgroundSecondary` appear in the selection menu when selecting a Border color:

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-32495850fc6b9cd4af0b6de671ec59c22db60b97%2Fthemes-and-control-variants-v184-13.png?alt=media" alt="" width="300"><figcaption></figcaption></figure>

It is best practice to tag variables so as to keep them organized, particularly if you are using custom variables to keep track of multiple colors, sizes, fonts, or units of time. To add a tag to a variable, select a tag from the dropdown menu that appears under **Tags** in the Inspector:

<figure><img src="https://2599974655-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIRF6etABDVMr59RdpyGw%2Fuploads%2Fgit-blob-67b4841ee7867266308e0b7e391684e0177bb083%2Fthemes-and-control-variants-v184-14.png?alt=media" alt="" width="200"><figcaption></figcaption></figure>

A single variable can be associated with any number of tags.
