Skip to main content
FrogBot lets you replace or extend parts of the Admin Panel with your own React components. Custom Components are React Server Components by default, so they can use the Local API without a separate HTTP request.
Client Components are supported. Add the 'use client' directive to the file. FrogBot removes non-serializable default props before rendering it.
FrogBot supports Custom Components in these scopes:

Defining Custom Components

Custom Components are registered in your FrogBot config using Component Paths. FrogBot uses the path to replace a built-in component or render your component in an available slot.

Component Paths

Components are referenced by path instead of being imported into the config. FrogBot detects the source directory: src when present, otherwise the project root. For example, /components/StatusAction resolves to src/components/StatusAction in the blank template. Append #ExportName for a named export. Omit it for a default export. You can also use an object with path and exportName.

Component Config

An object component reference can pass custom props alongside its path:

Import Map

FrogBot generates an import map that resolves every configured Component Path. It regenerates the map when the application starts and during development updates. You can regenerate it manually with:
Do not edit the generated import map. Change the component path in your config and regenerate it instead.
Plugin authors register public component paths in supported slots. Import helper components directly from the component module that renders them. The public admin.importMap option controls autoGenerate; see Import map options. baseDir and admin.dependencies are not supported authoring options.

Building Custom Components

Server Components

Server Components can use the FrogBot instance attached to the request. Component-specific types describe the props and the request location:
The exact props depend on the component slot. Use the exported type for the field, view, or slot you are implementing.

Custom Props

Client props must be serializable. Server props may contain server-only values when the receiving component remains a Server Component.

Client Components

Add 'use client' when a component needs state, effects, event handlers, or FrogBot’s client hooks:
Props crossing from a Server Component to a Client Component must be serializable.

Accessing Config

Server Components can read the sanitized config from req.frogbot.config. Client Components receive a serializable client config through useConfig:
Field components receive their field config as field: authored configuration on the server and serializable configuration on the client. Server field components also receive clientField for passing serializable configuration to a client component.

Rendering Component Slots

Use RenderCustomComponent to choose between an already-rendered React node and a fallback. It does not resolve component paths. An undefined node uses the fallback; null renders nothing.

Translations and Locale

Client Components can read the current language and locale with useTranslation and useLocale:
See Internationalization and Localization for configuration details.

Using Hooks

FrogBot’s curated @frogbotai/ui/admin entry exposes hooks that share the Admin Panel’s contexts. Import them from that entry:
Use useFormFields with a selector instead of subscribing to the entire form when you only need specific values.

Adding Styles

Import a CSS file from your component:
FrogBot UI components and theme tokens are available in every admin component without a wrapper and follow the admin’s light and dark theme. Use the admin’s semantic color tokens, such as --color-bg-secondary, --color-border and --color-text; they switch with the theme. Your component CSS beats FrogBot’s styles as long as it isn’t in a CSS layer. See override FrogBot styles and admin panel styles.

Tooltips

Wrap any element in Tooltip to label it on hover and keyboard focus. It looks like the admin’s own tooltips, follows the theme, and moves to the opposite side when there isn’t room:
The child must accept a ref and pass on hover and focus events, as buttons, links and FrogBot UI components do. Tooltip also works inside another component’s asChild trigger, such as a dropdown menu’s. Other props are passed to children. To restyle every tooltip, override the .fb-tooltip class in unlayered CSS, or set the tooltip color tokens --color-bg-tooltip and --color-text-ontooltip.

Performance

Keep the server/client boundary narrow. Prefer Server Components, pass only the serializable values a Client Component needs, and avoid broad form subscriptions that cause unrelated updates to re-render your component. Import Admin Panel hooks and curated UI components from the @frogbotai/ui/admin entry. Do not use deep element or icon imports. If a hook returns an undefined context, confirm that the component is rendered inside the Admin Panel and that your application resolves one version of each FrogBot package. See Troubleshooting.