Client Components are supported. Add the
'use client' directive to the file.
FrogBot removes non-serializable default props before rendering it.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: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: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:
Accessing Config
Server Components can read the sanitized config fromreq.frogbot.config. Client Components receive a serializable client config through useConfig:
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
UseRenderCustomComponent 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 withuseTranslation and useLocale:
Using Hooks
FrogBot’s curated@frogbotai/ui/admin entry exposes hooks that share the Admin Panel’s contexts. Import them from that entry:
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:--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 inTooltip 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:
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.