Skip to content

Table/Filter Fields ​

Fields define table columns, filter inputs, and action form inputs.

Used inside FieldsSchema as class attributes or constructor arguments.

Common parameters ​

All fields share these base parameters:

ParameterDescription
labelDisplay name for the column/field
help_textTooltip or helper text
requiredMark field as required
read_onlyDisable editing
defaultDefault value
default_fnCallback that computes the initial field value
headerShow in table header

default_fn computes the initial field value when the form loads its defaults. It supports synchronous functions, asynchronous functions, and lambdas. It takes precedence over default, including when it returns None. It is not called when saving the record.

python
from brilliance_admin import schema

title = schema.StringField(
    default_fn=lambda user, **context: f'Terminal by {user.username}',
)

StringField ​

Text input field.

ParameterDescription
min_lengthMinimum string length
max_lengthMaximum string length
passwordRender as password input
multilinedRender as textarea
ckeditorEnable CKEditor rich text
tinymceEnable TinyMCE rich text
choicesEnum class for predefined options

IntegerField ​

Numeric input field.

ParameterDescription
min_valueMinimum allowed value
max_valueMaximum allowed value
precisionTotal number of digits
scaleNumber of decimal digits
inputmodeHTML inputmode attribute
choicesEnum class for predefined options

BooleanField ​

Checkbox toggle. No additional parameters.

DateTimeField ​

Date and time picker.

ParameterDescription
rangeEnable date range selection (returns {from, to})
include_dateShow date picker (default True)
include_timeShow time picker (default True)

ChoiceField ​

Dropdown select with colored tags. Requires an Enum class with value, label and optional tag_color.

ParameterDescription
choices requiredEnum class
variantVuetify chip variant (default 'elevated')
sizeVuetify chip size (default 'default')
from enum import Enum

class StatusEnum(Enum):
    ACTIVE = 'active'
    BLOCKED = 'blocked'

    @property
    def label(self):
        return self.value.capitalize()

    @property
    def tag_color(self):
        return {'active': 'green', 'blocked': 'red'}.get(self.value)

status = schema.ChoiceField(label='Status', choices=StatusEnum)

JSONField ​

JSON editor. Accepts dict or list values.

ArrayField ​

List of values.

ParameterDescription
array_typeType of array elements

ImageField ​

Image display with preview.

ParameterDescription
preview_max_heightPreview height in pixels (default 100)
preview_max_widthPreview width in pixels (default 100)

FileField ​

File upload. No additional parameters.

RelatedField ​

Base field for related record selection. Renders as an autocomplete input in the UI. Used directly only for custom integrations — for SQLAlchemy, use SQLAlchemyRelatedField which is auto-generated.

ParameterDescription
manyTrue for list relationships (default False)
dual_listEnable dual-list UI for many relationships (default False)
filter_fnCustom async/sync function to modify the autocomplete query

FunctionField ​

Computed read-only field. Value is generated by an async function instead of reading from data.

from brilliance_admin import schema
from brilliance_admin.translations import TranslateText as _

class UsersSchema(schema.FieldsSchema):
    id = schema.IntegerField(label='ID')
    username = schema.StringField(label='Username')

    @schema.function_field(label='Full Name')
    async def full_name(self, record, user, **kwargs):
        return f"{record['first_name']} {record['last_name']}"

    list_display = ['id', 'username', 'full_name']

The type parameter sets the display type of the computed value. Without it, the value renders as StringField.

Pass any field class to use its rendering — for example BooleanField renders as a checkbox icon.

@schema.function_field(label=_('is_verified'), type=schema.BooleanField)
async def get_is_verified(self, record, user, **kwargs):
    return record['amount'] > 0

Or as a standalone field:

from brilliance_admin.schema.table.fields.base import FunctionField

async def compute_total(record, user, **kwargs):
    return record['price'] * record['quantity']

total = FunctionField(label='Total', fn=compute_total)