Turning flags on and off
Read time: 3 minutes
Last edited: Sep 15, 2023
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 a flag on or off directly from the flags list.
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.
You can also turn a flag on or off from the flag's Targeting tab. To learn more about flag targeting, read Targeting with flags.
Flag behavior can do a lot more than just turning features on or off. Continue reading to learn more.
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:
- Navigate to the flags list or the Targeting tab of a flag.
- 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.
- Click Review and save.
To learn more about creating flags, read Creating new flags.
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:
- Navigate to the flags list or the Targeting tab in the flag detail page.
- Set the toggle to Off. The variation the flag will serve when you save your changes appears.
- Click Review and save.
The Targeting tab displays this value at the bottom of the 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.
The Targeting tab displays the fallback value at the bottom of the tab:
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 Targeting with flags.