Skip to main content
Version: Next

@backstage/core-plugin-api

Home > @backstage/core-plugin-api

Core API used by Backstage plugins

Functions

Function

Description

AnalyticsContext(options)

Provides components in the child react tree an Analytics Context, ensuring all analytics events captured within the context have relevant attributes.

attachComponentData(component, type, data)

Stores data related to a component in a global store.

createComponentExtension(options)

Plain React component extension.

createExternalRouteRef(options)

Creates a route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.

createPlugin(config)

Creates Backstage Plugin from config.

createReactExtension(options)

Used by createComponentExtension() and createRoutableExtension().

createRoutableExtension(options)

Extension for components that can have its own URL route (top-level pages, tabs etc.).

createRouteRef(config)

Create a RouteRef from a route descriptor.

createSubRouteRef(config)

Create a SubRouteRef from a route descriptor.

getComponentData(node, type)

Retrieves data attached to a component.

useAnalytics()

Gets a pre-configured analytics tracker.

useApp()

React hook providing AppContext.

useElementFilter(node, filterFn, dependencies)

useElementFilter is a utility that helps you narrow down and retrieve data from a React element tree, typically operating on the children property passed in to a component.

useRouteRef(routeRef)

React hook for constructing URLs to routes.

useRouteRef(routeRef)

React hook for constructing URLs to routes.

useRouteRefParams(_routeRef)

React hook for retrieving dynamic params from the current URL.

Interfaces

Interface

Description

ElementCollection

A querying interface tailored to traversing a set of selected React elements and extracting data.

Variables

Variable

Description

analyticsApiRef

The ApiRef of AnalyticsApi.

Type Aliases

Type Alias

Description

AnalyticsApi

The Analytics API is used to track user behavior in a Backstage instance.

AnalyticsContextValue

Analytics context envelope.

AnalyticsEvent

Represents an event worth tracking in an analytics system that could inform how users of a Backstage instance are using its features.

AnalyticsEventAttributes

A structure allowing other arbitrary metadata to be provided by analytics event emitters.

AnalyticsTracker

Represents a tracker with methods that can be called to track events in a configured analytics service.

AnyExternalRoutes

Catch-all type for ExternalRouteRefs.

AnyParams

AnyRouteRefParams

Catch-all type for route params.

AnyRoutes

Catch-all route type.

AppComponents

A set of replaceable core components that are part of every Backstage app.

AppContext

The central context providing runtime app specific state that plugin views want to consume.

BackstagePlugin

Plugin type.

BootErrorPageProps

Props for the BootErrorPage component of AppComponents.

CommonAnalyticsContext

Common analytics context attributes.

ComponentLoader

Lazy or synchronous retrieving of extension components.

ErrorBoundaryFallbackProps

Props for the fallback error boundary.

Extension

Plugin extension type.

ExternalRouteRef

Route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references.

FeatureFlagsHooks

Interface for registering feature flags hooks.

MakeSubRouteRef

Creates a SubRouteRef type given the desired parameters and parent route parameters. The parameters types are merged together while ensuring that there is no overlap between the two.

MergeParams

Merges a param object type with an optional params type into a params object.

OptionalParams

Optional route params.

ParamKeys

Type describing the key type of a route parameter mapping.

ParamNames

Used in PathParams type declaration.

ParamPart

Used in PathParams type declaration.

PathParams

This utility type helps us infer a Param object type from a string path For example, /foo/:bar/:baz inferred to { bar: string, baz: string }

PluginConfig

Plugin descriptor type.

PluginFeatureFlagConfig

Plugin feature flag configuration.

RouteFunc

TS magic for handling route parameters.

RouteRef

Absolute route reference.

SignInPageProps

Props for the SignInPage component of AppComponents.

SubRouteRef

Descriptor of a route relative to an absolute RouteRef.