diff --git a/docs/reference/README.md b/docs/reference/README.md index 8438917945..dd926d57dc 100644 --- a/docs/reference/README.md +++ b/docs/reference/README.md @@ -4,5 +4,6 @@ APIs and Components - [createPlugin](createPlugin.md) - [createPlugin - router](createPlugin-router.md) +- [createPlugin - feature flags](createPlugin-feature-flags.md) [Back to Docs](../README.md) diff --git a/docs/reference/createPlugin-feature-flags.md b/docs/reference/createPlugin-feature-flags.md new file mode 100644 index 0000000000..d8ad043ddc --- /dev/null +++ b/docs/reference/createPlugin-feature-flags.md @@ -0,0 +1,15 @@ +# createPlugin - feature flags + +The `featureFlags` object passed to the `register` function makes it possible for plugins to register Feature Flags in Backstage for users to opt into. You can use this to split out logic in your code for manual A/B testing, etc. + +```typescript +// This needs to be updated. +``` + +Then, later, if you want to check if the user has enabled them: + +```typescript +// This needs to be updated. +``` + +[Back to References](README.md) diff --git a/docs/reference/createPlugin.md b/docs/reference/createPlugin.md index 77048199ef..c0b4dece71 100644 --- a/docs/reference/createPlugin.md +++ b/docs/reference/createPlugin.md @@ -17,13 +17,14 @@ type PluginHooks = { }; ``` -[Read more about the router here](createPlugin-router.md) +- [Read more about the router here](createPlugin-router.md) +- [Read more about feature flags here](createPlugin-feature-flags.md) ## Example Uses ### Creating a basic plugin -Showcasing adding multiple routes and a redirect. +Showcasing adding multiple routes, a feature flag and a redirect. ```jsx import { createPlugin } from '@backstage/core'; @@ -31,7 +32,9 @@ import ExampleComponent from './components/ExampleComponent'; export default createPlugin({ id: 'new-plugin', - register({ router }) { + register({ router, featureFlags: { registerFeatureFlag } }) { + registerFeatureFlag('enable-example-component'); + router.registerRoute('/new-plugin', ExampleComponent); }, });