SWC widget catalog
Built-in field widgets registered in core/swc/src/widgets/registry.ts. Reference a widget in view XML with widget="…" on . When omitted, SWC infers a widget from the ORM field type.
Registry keys
| Widget key | Component | ORM types | Default when omitted |
|---|---|---|---|
default, char | DefaultField | Char | Char fields |
email | DefaultField (type=email) | Char | — |
integer, float, numeric | DefaultField | Integer, Float, Numeric | matching type |
text, json | TextareaField | Text | Text |
date | DateField | Date | Date |
datetime | DateTimeField | DateTime | DateTime |
boolean | BooleanField | Boolean | Boolean |
boolean_toggle | BooleanToggleField | Boolean | — |
radio | BooleanRadioField | Boolean, Selection | — |
phone | PhoneField | Char | — |
selection | SelectionField | Selection, Many2one | Selection |
many2one | Many2OneField | Many2one | Many2one |
many2many, many2many_tags | Many2ManyTagsField | Many2many | Many2many → tags |
one2many | One2ManyField | One2many | One2many |
statusbar | StatusbarField | Selection | — |
priority | PriorityField | Selection, Integer | — |
image | ImageField | Binary, Char | — |
monetary | MonetaryField | Float, Numeric | — |
html | HtmlField | Text | — |
binary | BinaryField | Binary | — |
reference | ReferenceField | Reference | — |
color | ColorField | Char | — |
url | UrlField | Char | — |
progress, progressbar | ProgressField | Float, Integer | — |
Scalar widgets
default / char / email / integer / float
<field name="name"/>
<field name="email" widget="email"/>
<field name="amount" widget="float"/>
Renders a text or number input. Email uses type="email". Autocomplete tokens are inferred from field names (email, phone, name, …) in field-shell.ts.
text
<field name="note" widget="text"/>
Multiline textarea for Text fields.
date / datetime
<field name="date_start" widget="date"/>
<field name="scheduled_at" widget="datetime"/>
Native inline or datetime-local with Today/Clear actions.
Boolean widgets
boolean
<field name="active" widget="boolean"/>
Standard checkbox in the field shell.
boolean_toggle
<field name="active" widget="boolean_toggle"/>
Compact toggle with On/Off label. Works in list and form views.
radio
<field name="type" widget="radio"/>
Radio group for selection or boolean fields.
Relational widgets
many2one
<field name="partner_id" widget="many2one"
options="domain:[('customer','=',True)]"/>
Autocomplete search with RPC search_read. Domain supports $field_name$ placeholders.
many2many_tags
<field name="tag_ids" widget="many2many_tags"/>
Tag chips with add/remove. Default widget for Many2many when widget is omitted.
one2many
<field name="line_ids">
<list editable="bottom">
<field name="product_id"/>
<field name="quantity"/>
</list>
</field>
Embedded editable list. Opens dialog for create when configured.
Special widgets
statusbar
<header>
<field name="state" widget="statusbar" options="clickable:1"/>
</header>
Workflow stage chips. Options:
| Option | Values | Effect |
|---|---|---|
clickable | 1 | Click stage to write field value |
states | comma list | Limit visible states |
relation | model name | Related model for state labels |
priority
<field name="priority" widget="priority" options="mode:stars,stars:5"/>
Star rating or select dropdown. Options: mode (stars / select), stars / max (count).
image
<field name="image" widget="image"/>
Image upload with crop support. Use options for circle avatar on kanban.
monetary
<field name="amount_total" widget="monetary" options="currency_symbol:$"/>
Formatted currency display.
html
<field name="description" widget="html"/>
Read-only HTML preview or editable textarea depending on readonly mode.
binary
<field name="attachment" widget="binary"/>
File upload field.
reference
<field name="ref" widget="reference"/>
Generic model+id reference (limited v1 UI).
color
<field name="color" widget="color"/>
Color picker input.
url
<field name="website" widget="url"/>
URL input with link affordance.
progress / progressbar
<field name="progress" widget="progressbar"/>
Progress bar for numeric completion fields.
Custom widgets
Register from an addon entry module:
registry.category("fields").add("my_widget", MyWidgetClass);
<field name="x" widget="my_widget"/>
See Build a module with SWC and SWC widgets.