Skip to main content

Overview

Fields define the structure of database columns in Brainbox. Each field has a type that determines what kind of data it can store and how it’s displayed. Fields are not standalone nodes - they are embedded within Database node attributes.

Field Attributes Schema

const fieldAttributesSchema = z.discriminatedUnion('type', [
  booleanFieldAttributesSchema,
  collaboratorFieldAttributesSchema,
  createdAtFieldAttributesSchema,
  createdByFieldAttributesSchema,
  dateFieldAttributesSchema,
  emailFieldAttributesSchema,
  fileFieldAttributesSchema,
  multiSelectFieldAttributesSchema,
  numberFieldAttributesSchema,
  phoneFieldAttributesSchema,
  relationFieldAttributesSchema,
  rollupFieldAttributesSchema,
  selectFieldAttributesSchema,
  textFieldAttributesSchema,
  urlFieldAttributesSchema,
  updatedAtFieldAttributesSchema,
  updatedByFieldAttributesSchema,
])
Source: /home/daytona/workspace/source/packages/core/src/registry/nodes/field.ts:186-204

Common Field Properties

All field types share these common properties:
id
string
required
Unique identifier for the field
type
string
required
The field type (discriminator)
name
string
required
Display name of the field/column
index
string
required
Fractional index for ordering fields in the database view

Field Types

Boolean Field

z.object({
  id: z.string(),
  type: z.literal('boolean'),
  name: z.string(),
  index: z.string(),
})
Stores true/false checkbox values.

Text Field

z.object({
  id: z.string(),
  type: z.literal('text'),
  name: z.string(),
  index: z.string(),
})
Stores multi-line text content.

Number Field

z.object({
  id: z.string(),
  type: z.literal('number'),
  name: z.string(),
  index: z.string(),
})
Stores numeric values.

Email Field

z.object({
  id: z.string(),
  type: z.literal('email'),
  name: z.string(),
  index: z.string(),
})
Stores email addresses.

Phone Field

z.object({
  id: z.string(),
  type: z.literal('phone'),
  name: z.string(),
  index: z.string(),
})
Stores phone numbers.

URL Field

z.object({
  id: z.string(),
  type: z.literal('url'),
  name: z.string(),
  index: z.string(),
})
Stores URLs/links.

Date Field

z.object({
  id: z.string(),
  type: z.literal('date'),
  name: z.string(),
  index: z.string(),
})
Stores date values.

Select Field

z.object({
  id: z.string(),
  type: z.literal('select'),
  name: z.string(),
  index: z.string(),
  options: z.record(z.string(), selectOptionAttributesSchema).optional(),
})
options
Record<string, SelectOption>
Map of option IDs to option definitions:
{
  id: z.string(),
  name: z.string(),
  color: z.string(),
  index: z.string(),
}
Single-select dropdown with custom options.

Multi-Select Field

z.object({
  id: z.string(),
  type: z.literal('multi_select'),
  name: z.string(),
  index: z.string(),
  options: z.record(z.string(), selectOptionAttributesSchema).optional(),
})
Multi-select dropdown with custom options. Uses the same option schema as Select field.

File Field

z.object({
  id: z.string(),
  type: z.literal('file'),
  name: z.string(),
  index: z.string(),
})
Stores file attachments.

Collaborator Field

z.object({
  id: z.string(),
  type: z.literal('collaborator'),
  name: z.string(),
  index: z.string(),
})
Stores references to workspace users.

Relation Field

z.object({
  id: z.string(),
  type: z.literal('relation'),
  name: z.string(),
  index: z.string(),
  databaseId: z.string().optional().nullable(),
})
databaseId
string | null
ID of the target database to link records from
Creates links to records in another database.

Rollup Field

z.object({
  id: z.string(),
  type: z.literal('rollup'),
  name: z.string(),
  index: z.string(),
})
Aggregates values from related records (via Relation fields).

Created At Field

z.object({
  id: z.string(),
  type: z.literal('created_at'),
  name: z.string(),
  index: z.string(),
})
Auto-populated timestamp when the record was created.

Created By Field

z.object({
  id: z.string(),
  type: z.literal('created_by'),
  name: z.string(),
  index: z.string(),
})
Auto-populated user who created the record.

Updated At Field

z.object({
  id: z.string(),
  type: z.literal('updated_at'),
  name: z.string(),
  index: z.string(),
})
Auto-populated timestamp when the record was last updated.

Updated By Field

z.object({
  id: z.string(),
  type: z.literal('updated_by'),
  name: z.string(),
  index: z.string(),
})
Auto-populated user who last updated the record.

Select Option Schema

Used by Select and Multi-Select fields:
z.object({
  id: z.string(),
  name: z.string(),
  color: z.string(),
  index: z.string(),
})
id
string
Unique identifier for the option
name
string
Display name of the option
color
string
Color code for the option badge
index
string
Fractional index for ordering options

Build docs developers (and LLMs) love