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:
| Parameter | Description |
|---|---|
label | Display name for the column/field |
help_text | Tooltip or helper text |
required | Mark field as required |
read_only | Disable editing |
default | Default value |
default_fn | Callback that computes the initial field value |
header | Show 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.
from brilliance_admin import schema
title = schema.StringField(
default_fn=lambda user, **context: f'Terminal by {user.username}',
)StringField
Text input field.
| Parameter | Description |
|---|---|
min_length | Minimum string length |
max_length | Maximum string length |
password | Render as password input |
multilined | Render as textarea |
ckeditor | Enable CKEditor rich text |
tinymce | Enable TinyMCE rich text |
choices | Enum class for predefined options |
IntegerField
Numeric input field.
| Parameter | Description |
|---|---|
min_value | Minimum allowed value |
max_value | Maximum allowed value |
precision | Total number of digits |
scale | Number of decimal digits |
inputmode | HTML inputmode attribute |
choices | Enum class for predefined options |
BooleanField
Checkbox toggle. No additional parameters.
DateTimeField
Date and time picker.
| Parameter | Description |
|---|---|
range | Enable date range selection (returns {from, to}) |
include_date | Show date picker (default True) |
include_time | Show time picker (default True) |
ChoiceField
Dropdown select with colored tags. Requires an Enum class with value, label and optional tag_color.
| Parameter | Description |
|---|---|
choices required | Enum class |
variant | Vuetify chip variant (default 'elevated') |
size | Vuetify 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.
| Parameter | Description |
|---|---|
array_type | Type of array elements |
ImageField
Image display with preview.
| Parameter | Description |
|---|---|
preview_max_height | Preview height in pixels (default 100) |
preview_max_width | Preview 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.
| Parameter | Description |
|---|---|
many | True for list relationships (default False) |
dual_list | Enable dual-list UI for many relationships (default False) |
filter_fn | Custom 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'] > 0Or 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)