FrogBot also contributes fields to collections with framework roles. See role-marked collections and Default Fields.
Field types
Choose the field type that matches the value and editing experience you need.Data fields
Data fields have aname and ordinarily store their value in the database.
- Array for repeating rows of nested fields
- Blocks for block-based content
- Checkbox for boolean values
- Code for source code stored as a string
- Date for date and time values
- Email for validated email addresses
- Group for fields nested in a keyed object
- JSON for structured JSON values
- Number for numeric values
- Point for geographic coordinates
- Radio for one value from a visible set of choices
- Relationship for references to other collections
- Rich Text for structured rich content
- Select for one or more values from a choice list
- Tabs for named groups displayed as tabs
- Text for single-line strings
- Textarea for multi-line strings
- Upload for references to file collections
Layout fields
Layout fields organize the admin form and do not store their own value.- Collapsible groups fields in an expandable section.
- Row arranges fields horizontally.
- Unnamed Groups and unnamed Tabs arrange nested fields without adding another key to the Document.
- UI renders a custom interface without storing data.
Virtual fields
Join fields are virtual by design. Other data fields can usevirtual: true and an afterRead hook to return a computed value without persisting it.
Virtual field configuration
Any data field can be made virtual by setting itsvirtual property. Virtual values appear in API responses and can be displayed in the admin panel, but FrogBot does not persist them in the database. They are useful for computed values, relationship summaries, and formatted versions of stored data.
The virtual property accepts either true or a string relationship path.
Boolean virtual fields
Settingvirtual: true marks the field as virtual but does not populate it. Use an afterRead field hook to calculate its value.
String path virtual fields
A stringvirtual value creates a virtual relationship field. FrogBot follows the path from a relationship in the current Document and returns the value at the destination.
Display in the admin
In List, Board and Calendar, a string path virtual field shows its value the way the field at the end of the path shows it. A path to a money field shows a money amount, a path to a select or radio with option colors shows the coloured pill, and a path to a date uses that date field’s display format. An empty value shows what the source field shows when it is empty, so an empty money amount shows nothing, and0 shows as zero ($0.00).
12.5 shows $12.50 in the Project Budget column, and a task tagged “urgent” and “backend” shows urgent, backend.
- Sources. The field at the end of the path can be a text, textarea, email, number, select, radio, checkbox or date field, including fields built on them such as money. The path can cross several relationships, named groups and named tabs.
- Lists. When the path crosses a
hasManyrelationship, each non-empty value is shown with the source field’s display, separated by commas. In the List, only the first value links to the Document. - Type and options. Give the virtual field the source field’s
type,optionsandhasMany. The display follows the source field, but filters and generated types follow what you write on the virtual field. - Paths that can’t be followed. If the path names a field that doesn’t exist, passes through an array or blocks field, crosses a relationship to more than one collection, or ends at an unsupported or virtual field, the field shows as a plain value. A misspelt path returns an empty value and doesn’t stop FrogBot from starting.
- Your own display. A custom
Cellon the virtual field, or a field factory such asmoneyField()used for the virtual field itself, is used instead of the source field’s display. - Edit view. The edit view shows the virtual field’s own read-only input for the type you wrote. For example, a number virtual field pointing at a money field shows
12.5.
Virtual path syntax
Virtual paths use dot notation to traverse relationships and nested data:author.namereturns thenamefield from theauthorrelationship.author.profile.bioreturnsbiofrom the related author’s nestedprofileobject.categories.titlereturns thetitlevalues from ahasManyrelationship.request.additionalStakeholders.emailtraverses multiple relationship levels.
hasMany relationship, the virtual field returns an array of values.
Common use cases
Displaying relationship names
Add a virtual field when an API response should expose a useful property next to a relationship ID:Multiple relationship values
Virtual paths throughhasMany relationships return arrays:
Computed values
Use a hook when the result is calculated rather than read from a relationship:Virtual fields in API responses
Virtual fields appear alongside stored fields in API responses:Field options
Every field requires atype. Data fields also require a name. Each field type adds options for its value, storage, validation, and editing interface.
Field names
Field names become keys in API response objects and generated TypeScript types. Names must be unique among sibling fields. Use JavaScript-style identifiers that begin with a letter or underscore and contain only letters, numbers, and underscores. FrogBot reserves internal names. A reserved field is removed while the configuration is sanitized. The following names cannot be used:__vsalthashfilestatuswhen drafts and the Postgres adapter are enabled
Field-level hooks
Field hooks run at specific points while FrogBot creates, updates, or reads a Document.FrogBotRequest. Server hooks access the current framework instance through req.frogbot, not through a separate global or per-field instance.
Field-level access control
Field access functions control whether a field can be created, updated, or read. They return a boolean and receive the currentreq, Document data, and sibling data.
Default values
UsedefaultValue to populate a missing value during create or update operations and when the Admin Panel opens a create form. It can be a static value or a function based on the current locale or authenticated user.
Validation
FrogBot automatically validates field types and constraints such asrequired, min, max, and length limits. Set validate to replace a field’s default validator with application-specific logic.
true when the value is valid or an error-message string when it is invalid. It may also return a promise. The context includes:
Validation context
Use the context to compare sibling values, inspect the operation, identify the current Document, or read the authenticated user fromreq.user.
The context also includes the field’s own settings as top-level properties, such as
minLength on a Text field or max on a Number field. These settings are typed for that field type and exclude hooks, access, and validate.
operation can be any of the four operations or undefined, so a validator that switches on it should handle read and delete too.
Localized error messages
Validation can use the request translation function to return a localized built-in message:Replacing default field validation
When a field definesvalidate, FrogBot uses that function instead of the field type’s default validator. FrogBot does not expose the built-in validators through a supported public helper import. Include every type, required, length, range, or format rule that the replacement must retain.
Validation performance
The admin panel runs validation whenever a field changes. Keep synchronous andonChange checks lightweight. For expensive work such as a remote lookup, use event to defer it until form submission.
req.frogbot for client-side database work. Enforce authoritative rules on the server and use hooks or access control when the check requires framework operations.
Role-marked collections
FrogBot can merge managed fields into a collection marked withchat: true, message: true, file: true, or usageLog: true. A collection can have only one of these role markers, and only one collection can fill each role.
Admin options
Use a field’sadmin property to control its presentation without changing API behavior.
Field descriptions
Descriptions give editors instructions or context near a field. Their exact placement depends on the field type. A description can be a string, a server-side function that returns a string, or a custom React component.Description functions
Description functions run on the server and are useful for simple localized text. They receivet, the translation function used by the admin panel, and the i18n object.
A description function is not reactive to live form changes. Use a client Description component when the content must subscribe to form state.
Conditional logic
Anadmin.condition function receives the full form data, sibling data, and context about the field’s location and current user. Return true to display the field.
The context object contains:
Custom components
Fields are represented in several places in the admin panel: the form field in an Edit view, a table cell and filter in a List view, and a diff when comparing versions. Setadmin.components to replace any of these surfaces or one of the smaller field slots. Component paths are resolved through FrogBot’s import map.
Layout fields support a subset: Row fields, Tabs fields, and individual tabs have only
Field, Cell, Filter, Description, and Diff; Group and Collapsible fields have no Error slot; and UI fields are described on the UI field page. Array fields add RowLabel.
Field
The Field component is the form control editors interact with in an Edit view. Replace it withadmin.components.Field:
Default props
Exact props vary by field family, so type your component with that family’s exported prop or component type. Client field components receive:
Some families add props, such as
inputRef and onKeyDown on Text fields.
Server field components receive the same path, schemaPath, readOnly, permissions, forceRender, and renderedBlocks props, plus:
FrogBot’s server prop types expose
req.frogbot and do not expose a separate top-level framework instance.
Sending and receiving form values
Client components manage form state with hooks and field primitives from@frogbotai/ui/admin. Import the corresponding component type from frogbot.
Server field components
Server component types follow the same field-specific naming convention. For example,TextFieldServerProps and TextFieldServerProps are exported from frogbot. Their framework-issued req is a FrogBotRequest, and req.frogbot is attached before the component renders, including form-state rebuilds.
getFrogBot({ config }) when they need server access.
Field component types
Each field family exports the props its components receive fromfrogbot: *FieldClientProps and *FieldServerProps, plus *FieldLabel*Props, *FieldDescription*Props, *FieldError*Props and *FieldDiff*Props. Type a component by its props, as in ({ field }: TextFieldServerProps) => …. UI fields do not have label, description, or error props; Blocks fields additionally provide BlockRowLabelServerProps and BlockRowLabelClientProps.
Cell
The Cell component renders a field’s value in a List view table. Replace it withadmin.components.Cell:
Cell appears only in the List view; Board cards and Calendar events show FrogBot’s built-in display for the field. To draw a field the same way in a custom Board Card or Calendar Event, render FieldCell from @frogbotai/ui/admin with the Cell props below.
Cells use the generic DefaultCellComponentProps or DefaultServerCellComponentProps types from frogbot. Cell components do not receive field-component form props or a request.
Server cells additionally receive
collectionConfig, the sanitized collection configuration, and i18n, the admin internationalization object.
Cell components are optimized for table rendering. They do not receive Field component props such as
preferences, validate, or path, and they do not receive a request.Filter
The Filter component is the input shown in the List view’s Filter By menu. It represents this field when an editor builds a query.clientProps set in its component configuration. Custom filters apply to top-level fields only.
Label
The Label component is used wherever the admin panel labels a field, most commonly in Edit views.Description
Use a Description component instead of theadmin.description property when the description needs rich markup, live form values, or interaction.
Error
The Error component renders when field validation fails, usually beneath the input.Diff
The Diff component renders a field in the Version Diff view and is visible only when versioning is enabled.afterInput and beforeInput
UsebeforeInput and afterInput to add components around the input without replacing the complete Field component. Each option accepts an array, so multiple components can occupy either slot.
'use client'.
Use only the curated admin hooks and field primitives exported by @frogbotai/ui/admin. General-purpose admin internals and element subpaths are not part of this contract. Component paths, server and client boundaries, and import-map generation follow the conventions above.
TypeScript
ImportField, individual field configuration types, and custom component types from frogbot. Container field types are recursive, so nested fields retain FrogBot hook, access, and validation request types.
frogbot generate:types to generate your application’s frogbot-types.ts declarations from the configured collections and fields. See TypeScript for generated type setup.