No results for ""
EXPAND ALL
  • Home
  • API docs

GIVE DOCS FEEDBACK

Turning flags on and off

Read time: 3 minutes
Last edited: Mar 11, 2024

Overview

This topic explains how to enable and disable flags in the LaunchDarkly platform.

One-click control of flag behavior is critical to nimble feature management. With LaunchDarkly, you can turn targeting on or off directly from the flags list.

The flag toggle button is a circuit breaker for any feature

The flag button lets you turn off a feature that's misbehaving without needing to touch any code or re-deploy your application. Wrap the entire feature in a feature flag to control or revoke its rollout seamlessly.

Use the toggle in a flag's Targeting tab

You can also turn a flag's targeting on or off from the flag's Targeting tab. To learn more about flag targeting, read Target with flags.

Flag behavior can do a lot more than just turning features on or off. Continue reading to learn more.

Turning flags on

When you create a new flag, it is turned Off by default. You can turn the flag On by clicking the flag toggle button in the flags list or the flag's Targeting tab.

To turn a flag on:

  1. Navigate to the flags list or the Targeting tab of a flag.
  2. Click the flag toggle. The toggle turns green and displays the word On. The variation the flag will serve when you save your changes appears.
The flag toggle in the "Targeting" tab.
The flag toggle in the "Targeting" tab.
  1. Click Review and save.

To learn more about creating flags, read Creating new flags.

Turning flags off

When you turn a flag to Off, you disable the targeting rules for that flag. Instead of serving an active variation, you serve the off variation.

In the Targeting tab, you can set an off variation for both boolean and multivariate flags. Boolean feature flags default to false when the feature flag is Off.

To turn a flag Off:

  1. Navigate to the flags list or the Targeting tab in the flag detail page.
  2. Set the toggle to Off. The variation the flag will serve when you save your changes appears.
  3. Click Review and save.

The Targeting tab displays this value at the top of the tab:

The off default value at the top of the "Targeting" tab.
The off default value at the top of the "Targeting" tab.

If you don't specify an explicit default off variation, LaunchDarkly serves the fallback value for the flag. You can specify the fallback value in your code's variation calls.

Planning feature flags for future events

You can schedule a flag for a particular date using scheduled flag changes, or you can use targeting rules to control what it affects and when. For example, you can serve false to deprecate a feature after a date of your choosing, or you can target a specific context or segment to be removed from the flag's targeting settings. To learn more, read Target with flags.