• SDKS
No results for ""


Flag variations

Read time: 2 minutes
Last edited: Mar 18, 2020


This topic explains how to use a flag's Variations tab to create and edit your feature flag's variations and outlines the different types of flag variations.

A flag's dashboard with the Variations tab called out.
A flag's dashboard with the Variations tab called out.

Understanding flag types

LaunchDarkly supports different flag types.

  • Boolean flags have two settings: true or false.
  • Multivariate flags have multiple settings that let you define different variations. Those settings include strings, numbers, JSON objects, or JSON arrays.

To learn more about creating different types of flags, read Creating a feature flag.

Managing flag variations

In the Variations tab, you can add, edit, or delete variations of existing flags.

Boolean flags never need variations, because they can only be set to true or false. Multivariate flags, however, can be configured in many ways to create custom experiences or reactions.

Here are the flag modifications you can do in the flag's Variations tab:

  • Boolean flags: you can edit each variation’s name and description.
  • Multivariate flags: you can edit any variation’s value, name, and description. You can also add and delete variations for a multivariate flag.

The Variations tab with different flag variations displayed.
The Variations tab with different flag variations displayed.

When you add, edit, or delete a feature flag's variations, the change impacts environments within the project.

Changing variation types
After a feature flag has been created, you cannot change the type of its variations. For example, you can't edit a feature flag that returns numbers to make it return strings instead.
Deleting variations

When you delete a variation, custom rules that return that variation are also deleted. If a custom rule has a percentage rollout, the rollout for that variation is set to zero. If the default rule returns the deleted variation, it will be changed to return the off variation instead.

Changing default flag variations

When you create a feature flag, some of its variations are designated as default variations. A flag's default variations are the variations that are served when a flag is on or off unless you specify otherwise.

For example, a boolean flag could have false set as its default off variation and true set as its default on variation. A multivariate flag could have variation 1 set as its default off variation and variation 2 set as its default on variation, with variation 3 and variation 4 configured to appear in other, more specific circumstances, such as when a user is based in a specific region or has a certain email address.

Default variations are designated automatically every time you create a feature flag. You can accept the default variations or change them. When you do this and click Save Flag, the flag is created across all environments in your project with these variations set as its on and off values.

The default variation options on the flag creation screen.
The default variation options on the flag creation screen.

You can change a flag's default variations from the Variations tab. Update the default variations in the "Defaults for new environments" section. Subsequent environments you create also use the flag's default values. If you change the default variations and then create a new environment, however, the environment you create will use the updated default variations.

Editing default variations only impacts new environments
If you modify a flag's default variations, the updated default variations only apply to new environments. You can not change the default variations in environments that already exist.