Skip to content

Every field type

Every control Borm draws, in one form - each field's help text is the builder call that asks for it. A field's type is intent (BormFieldType), not a widget: the renderer registry maps each one to a control, and every control is plain, labelled HTML. From a C# model the type is inferred from the property; this form has no model at all, so it is built by name with BormBuilder.Create() and bound to a dictionary.

Fill in anything and press Submit to see what each control stores - text, numbers, dates, a list for a multi-select or tags, a nested dictionary for the address, a list of them for the children. The page also holds a Hidden value you cannot see, which arrives with the rest. The search box has its label hidden with HideLabel(), which keeps it as the accessible name.
Live form
One of everything

Text

Text("fullName")

Email("email") - the type and the rule

AsUrl().Url()

AsTel() - the phone keypad

Password(...).Revealable()

AsSearch().HideLabel()

TextArea(...) or AsTextArea(rows)

Numbers

Integer(...).Range(1, 12)

Number(...).Prefix("€").Step(0.01)

MultipleOf(6) - sold by the half dozen

50

AsRange() - a slider

Dates, times and colours

Date(...)

Field(..., BormFieldType.DateTime)

Field(..., BormFieldType.Time)

AsMonth() - "2026-05"

AsWeek() - "2026-W19"

AsColor() - "#rrggbb"

Choices

Checkbox(...)

AsSwitch() - a checkbox announced as a switch

Select(...).Options(...)

OptionsFromEnum<DayOfWeek>()

Delivery

Radio(...) - one tab stop, arrow keys inside

Toppings

MultiSelect(...) - a list of values

4 choices available

Combobox(...) - type to filter

Labels

Tags(...) - Enter or a comma adds one

Files, formatted text and signatures

File(...).Accept(".pdf,image/*")

Formatting help
**bold**
bold
*italic*
italic
`code`
code
[link](https://…)
link
- bulleted list
bulleted list
1. numbered list
numbered list
> quote
quote
# heading
heading

AsMarkdown() - Markdown with a safe preview

Signature

AsSignature() - drawn, or typed instead

CustomRenderer("rating") - a component of your own

Groups and lists

Static(...) - this heading is a field too.

Address

Object(...) - a nested dictionary

Other phone numbers

ArrayOf(..., BormFieldType.Tel).Items(max: 3).UniqueItems()

No items yet.

Children

Array(...) - a list of dictionaries

No childs yet.

View source
@page "/field-types"

<BormView Definition="_schema" Data="_data" OnValidSubmit="HandleSubmit" ShowErrorSummary="true" />

@code {
    // No model: the form binds to a dictionary, written in place.
    private readonly Dictionary<string, object?> _data = new();

    private readonly BormDefinition _schema = BormBuilder.Create()
        .Title("One of everything")
        .Columns(2)

        .Static("text", "Text", configure: f => f.ColumnSpan(2))
        .Text("fullName", f => f.Label("Full name").Required().Help("Text(\"fullName\")"))
        .Email("email", f => f.Label("Email").Help("Email(\"email\") - the type and the rule"))
        .Text("website", f => f.Label("Website").AsUrl().Url().Help("AsUrl().Url()"))
        .Text("phone", f => f.Label("Phone").AsTel().Help("AsTel() - the phone keypad"))
        .Password("password", f => f.Label("Password").Revealable().Help("Password(...).Revealable()"))
        .Text("search", f => f.Label("Search the catalogue").AsSearch().HideLabel()
            .Placeholder("Search the catalogue").Help("AsSearch().HideLabel()"))
        .TextArea("bio", f => f.Label("About you").AsTextArea(3).ColumnSpan(2).Help("TextArea(...) or AsTextArea(rows)"))

        .Static("numbers", "Numbers", configure: f => f.ColumnSpan(2))
        .Integer("guests", f => f.Label("Guests").Range(1, 12).Help("Integer(...).Range(1, 12)"))
        .Number("price", f => f.Label("Price").Prefix("€").Step(0.01).Help("Number(...).Prefix(\"€\").Step(0.01)"))
        .Integer("eggs", f => f.Label("Eggs").MultipleOf(6).Help("MultipleOf(6) - sold by the half dozen"))
        .Integer("volume", f => f.Label("Volume").AsRange().Range(0, 100).Step(5).Default(50).Help("AsRange() - a slider"))

        .Static("pickers", "Dates, times and colours", configure: f => f.ColumnSpan(2))
        .Date("arrival", f => f.Label("Arrival").Help("Date(...)"))
        .Field("meeting", BormFieldType.DateTime, f => f.Label("Meeting").Help("Field(..., BormFieldType.DateTime)"))
        .Field("checkIn", BormFieldType.Time, f => f.Label("Check-in time").Help("Field(..., BormFieldType.Time)"))
        .Text("billingMonth", f => f.Label("Billing month").AsMonth().Help("AsMonth() - \"2026-05\""))
        .Text("deliveryWeek", f => f.Label("Delivery week").AsWeek().Help("AsWeek() - \"2026-W19\""))
        .Text("brandColour", f => f.Label("Brand colour").AsColor().Help("AsColor() - \"#rrggbb\""))

        .Static("choices", "Choices", configure: f => f.ColumnSpan(2))
        .Checkbox("newsletter", f => f.Label("Send me the newsletter").Help("Checkbox(...)"))
        .Checkbox("darkMode", f => f.Label("Dark mode").AsSwitch().Help("AsSwitch() - a checkbox announced as a switch"))
        .Select("size", f => f.Label("Size").Options(("s", "Small"), ("m", "Medium"), ("l", "Large"))
            .Help("Select(...).Options(...)"))
        .Select("weekday", f => f.Label("Delivery day").OptionsFromEnum<DayOfWeek>()
            .Help("OptionsFromEnum<DayOfWeek>()"))
        .Radio("delivery", f => f.Label("Delivery").Options(("post", "Post"), ("courier", "Courier"), ("pickup", "Pick-up"))
            .Help("Radio(...) - one tab stop, arrow keys inside"))
        .MultiSelect("toppings", f => f.Label("Toppings").Options(("cheese", "Cheese"), ("olives", "Olives"), ("basil", "Basil"))
            .Help("MultiSelect(...) - a list of values"))
        .Combobox("country", f => f.Label("Country").Options(("fr", "France"), ("de", "Germany"), ("jp", "Japan"), ("gb", "United Kingdom"))
            .Help("Combobox(...) - type to filter"))
        .Tags("labels", f => f.Label("Labels").AsTags(max: 5).Help("Tags(...) - Enter or a comma adds one"))

        .Static("rich", "Files, formatted text and signatures", configure: f => f.ColumnSpan(2))
        .File("attachment", f => f.Label("Attachment").Accept(".pdf,image/*").ColumnSpan(2).Help("File(...).Accept(\".pdf,image/*\")"))
        .Text("notes", f => f.Label("Notes").AsMarkdown(3).ColumnSpan(2).Help("AsMarkdown() - Markdown with a safe preview"))
        .Text("signature", f => f.Label("Signature").AsSignature().ColumnSpan(2).Help("AsSignature() - drawn, or typed instead"))
        .Field("rating", BormFieldType.Custom, f => f.Label("Rating").CustomRenderer("rating").ColumnSpan(2)
            .Help("CustomRenderer(\"rating\") - a component of your own"))

        .Static("structure", "Groups and lists", "Static(...) - this heading is a field too.", f => f.ColumnSpan(2))
        .Object("address", a => a
                .Text("street", f => f.Label("Street"))
                .Text("city", f => f.Label("City")),
            f => f.Label("Address").ColumnSpan(2).Help("Object(...) - a nested dictionary"))
        .ArrayOf("phones", BormFieldType.Tel, f => f.Label("Other phone numbers").ColumnSpan(2)
            .Items(max: 3).UniqueItems().Help("ArrayOf(..., BormFieldType.Tel).Items(max: 3).UniqueItems()"))
        .Array("children", child => child
                .Text("name", f => f.Label("Name"))
                .Integer("age", f => f.Label("Age").Range(0, 17)),
            f => f.Label("Children").ColumnSpan(2).Attr("itemNoun", "child").Help("Array(...) - a list of dictionaries"))
        .Text("source", f => f.AsHidden().Default("field-types-page"))     // AsHidden(): sent, never shown
        .Build();
}

Choosing a type

  • From a model the type follows the property: string is text, int an integer, decimal a number, bool a checkbox, DateOnly/DateTime/TimeOnly the pickers, an enum a select, a [Flags] enum or List<TEnum> a multi-select, IBrowserFile a file, a class a group and a list of them a repeater. [EmailAddress], [Url], [Phone] and [DataType(Password)] narrow a string.
  • In the builder, As(BormFieldType.X) or one of its shortcuts - AsTextArea, AsEmail, AsUrl, AsTel, AsSearch, AsPassword, AsRange, AsColor, AsMonth, AsWeek, AsSelect, AsRadio, AsMultiSelect, AsCombobox, AsTags, AsSwitch, AsFile, AsMarkdown, AsSignature, AsHidden - changes it. A type changes the control, not the rules: AsUrl() brings the URL keyboard, Url() the rule.
  • In JSON Schema, type and format choose, and x-widget overrides - see JSON Schema.
  • Your own - CustomRenderer("key") draws a field with a component you register. The star rating above is one; see custom renderer.

The date, time, month, week and colour controls and the <datalist> behind a combobox are the browser's own, so they look like the platform and follow its keyboard and screen-reader support. Desktop Firefox and Safari have no month or week picker and show a text box; what is typed into one is checked rather than stored as it is.

An unhandled error has occurred. Reload 🗙