Skip to content

LocalFlagDevTools

The LocalFlagDevTools component provides a floating panel that allows you to toggle feature flags without changing code.

Include the LocalFlagDevTools component inside your FeatureFlagProvider:

import { FeatureFlagProvider, LocalFlagDevTools } from '@localflag/react';
import { defaultFlags } from './flags';
function App() {
return (
<FeatureFlagProvider defaultFlags={defaultFlags}>
<YourApp />
<LocalFlagDevTools />
</FeatureFlagProvider>
);
}

Toggle the DevTools panel with Cmd+Shift+F (Mac) or Ctrl+Shift+F (Windows/Linux).

To disable the shortcut:

<LocalFlagDevTools shortcut={false} />

When using createFlags, descriptions are displayed below each flag name:

import { createFlags, FeatureFlagProvider, LocalFlagDevTools } from '@localflag/react';
const { flags, descriptions } = createFlags({
darkMode: { value: false, description: "Enable dark theme" },
maxItems: { value: 10, description: "Maximum items per page" },
});
function App() {
return (
<FeatureFlagProvider defaultFlags={flags} descriptions={descriptions}>
<YourApp />
<LocalFlagDevTools />
</FeatureFlagProvider>
);
}

Boolean flags display as toggle switches. Click to enable or disable.

String and number flags show an input field where you can change the value.

Flags that have been changed from their default values are marked with a blue dot.

A “Reset overrides” button appears when any flags have been modified, allowing you to restore all default values.

The Options tab allows you to configure the LocalFlagDevTools panel directly from the UI.

Choose where the LocalFlagDevTools panel appears by selecting one of four positions:

  • Top Left
  • Top Right
  • Bottom Left
  • Bottom Right

The selected position is automatically saved and persists across page reloads.

All overrides and settings are automatically saved to localStorage:

  • Flag overrides: localflag:overrides
  • Panel position: localflag:position

Set the initial position via prop (can be changed later in the Options tab):

<LocalFlagDevTools position="bottom-right" /> {/* default */}
<LocalFlagDevTools position="bottom-left" />
<LocalFlagDevTools position="top-right" />
<LocalFlagDevTools position="top-left" />

Start with the panel expanded:

<LocalFlagDevTools defaultOpen={true} />

The keyboard shortcut is enabled by default. To disable it:

<LocalFlagDevTools shortcut={false} />

LocalFlagDevTools automatically hides itself in production builds. You don’t need to conditionally render it.