WHAT YOU'LL LEARN
  • how to register a build-time parameter in webiny.config.tsx
  • how to access it in React components and hooks via useBuildParams
  • how to access it in non-React Admin code via BuildParams

Overview
anchor

BuildParams is the mechanism for passing configuration values — determined at build time — into the Admin application. Values are registered in webiny.config.tsx using Admin.BuildParam and embedded directly into the Admin bundle during the build step. Inside React components and hooks, they are accessed via the useBuildParams hook. In non-React Admin code (services, class-based extensions), inject BuildParams directly via dependency injection.

Registering a Parameter
anchor

Declare parameters in webiny.config.tsx using Admin.BuildParam:

webiny.config.tsx

The value can be a string, number, boolean, object, or array.

Accessing Parameters in a Component
anchor

Use the useBuildParams hook anywhere in the Admin React tree:

extensions/SupportBanner.tsx

params.get<T>(key) returns the value typed as T, or null if the key was not registered.

You can also call useBuildParams inside a custom hook:

extensions/useSupportEmail.ts

Accessing Parameters in Non-React Code
anchor

In class-based Admin extensions (services, event handlers, use cases), inject BuildParams via the constructor:

extensions/MyAdminService.ts

Deploying
anchor

After adding or changing an Admin.BuildParam, rebuild and redeploy the Admin app:

During development, rerunning watch is enough — no full deploy needed: