Skip to content

Feature Flags

Nick Watts edited this page Aug 2, 2023 · 6 revisions

To add a feature flag, add an entry to the list in src/libs/feature-previews-config.ts.

Each entry should contain an object with the keys:

  • id: A unique ID for the feature
  • title: A short label for the feature
  • description: A longer description for the feature
  • groups (optional): A list containing names of Terra groups for which the feature is available
  • documentationUrl (optional): Link to documentation for the feature
  • feedbackUrl (optional): Link to submit feedback for the feature

To check if a feature preview is enabled, call isFeaturePreviewEnabled (imported from src/libs/feature-previews.js) and pass it the ID of the feature.

isFeaturePreviewEnabled('my-feature')

All features listed in feature-previews-config.ts will be shown on the feature previews page. If a feature preview is configured with groups, the feature will only be shown if the user is a member of one of the groups.

To enable/disable a feature outside of the feature preview page, use the toggleFeaturePreview function imported from src/libs/feature-previews.ts.

toggleFeaturePreview('my-feature', true)
Clone this wiki locally