Fields

Fields define the schema of a Base table. Each field has a type, a configuration, a default value, and capabilities such as sorting, filtering, grouping, or display on a card.

Bases UI configuration

UniverBasesUIPlugin

  • attachment
    object
    Upload an attachment and return its metadata.
    • accept
      string[]
      Limit the files that the attachment picker offers.
    • maxSize
      number
      Maximum attachment size, in bytes.
    • upload
      (file: File) => Promise<IBaseAttachment>
      Upload an attachment and return its metadata.
  • personOptions
    object[]
    The people that the Person picker offers.
    • id
      string
      Stable ID that identifies this option.
    • name
      string
      Name displayed in the picker.
    • avatar
      string
      URL of the option's avatar.
  • groupOptions
    object[]
    The groups that the Group picker offers.
    • id
      string
      Stable ID that identifies this option.
    • name
      string
      Name displayed in the picker.
    • avatar
      string
      URL of the option's avatar.

Attachment uploads

Configure upload handling in the same place where the Bases UI plugin is registered:

TypeScript
univer.registerPlugin(UniverBasesUIPlugin, {  attachment: {    accept: ['image/*', '.pdf'],    maxSize: 10 * 1024 * 1024,    upload: uploadAttachment,  },})

uploadAttachment is a function that the application provides, with the signature (file: File) => Promise<IBaseAttachment>, and it returns an attachment object such as the one in the example below. maxSize is measured in bytes. If no uploader is supplied, the plugin tries image IO and then Base64, which makes the snapshot larger. A production deployment should connect real file storage and validate file type, size, and download permissions on the backend.

People and groups

Pass the picker candidates through the personOptions and groupOptions options of the Bases UI plugin. Each item has id, name, and an optional avatar. These options control only what the pickers display; login and access permissions remain the responsibility of the application.

Field types

PurposeBaseFieldType
Text and contact detailsText, Link, Phone, Email
Numbers and progressNumber, Currency, Progress, Rating
Choices and membersCheckbox, SingleSelect, MultiSelect, Person, Group
Dates and attachmentsDate, Attachment
Calculations and relationshipsFormula, RecordLink
Generated values and audit fieldsNumbering, RecordId, CreatedBy, UpdatedBy, CreatedAt, UpdatedAt

Select values use option IDs, and Person and Group values use member IDs from the application. The system manages numbering and audit fields. Calculations are described in Formulas, and relationships in Records, links, and hierarchy.

Add fields

TypeScript
const table = base.getTableById('tasks')if (!table) throw new Error('Tasks table not found')const title = table.addField('Title', univerAPI.Enum.BaseFieldType.Text)const priority = table.addField(  'Priority',  univerAPI.Enum.BaseFieldType.SingleSelect,  {    field: {      config: {        options: [          { id: 'high', name: 'High', color: '#ef4444' },          { id: 'low', name: 'Low', color: '#22c55e' },        ],      },    },  },)

Update fields

TypeScript
priority.setName('Impact')priority.update({ description: 'Business priority' })priority.setConfig({  options: [    { id: 'p0', name: 'P0', color: '#dc2626' },    { id: 'p1', name: 'P1', color: '#f97316' },  ],})

Change field type

TypeScript
priority.changeType(univerAPI.Enum.BaseFieldType.Text, {})

Changing the type of a field may normalize existing values. Verify the data in the application before applying a schema change to a production table.

Attachment fields

An attachment requires a stable ID, a name, and a source that the browser can reach. The example assumes that the application has already uploaded the file:

TypeScript
const attachments = table.addField('Files', univerAPI.Enum.BaseFieldType.Attachment)const record = table.getRecords()[0]if (!record) throw new Error('Create a record first')record.setAttachments(attachments.getId(), [{  id: 'brief-1',  name: 'brief.pdf',  mimeType: 'application/pdf',  source: 'https://example.com/files/brief.pdf',}])

setAttachments() replaces the entire attachment list for the cell. Use getAttachments() to read the list and deleteAttachments() to remove individual entries. Replace the example URL with an address that users can reach.

How is this guide?

© 2026 DreamNum Co., Ltd.