percentField returns a Number field that stores a percentage as a fraction: 0.42 is 42%. The admin panel shows 42% and edits the value as a percentage, and agents and generated types are told what the number means. You don’t name any components or write a formatter.
number field, so it works anywhere a field does, including inside groups, arrays, tabs and blocks.
Config options
A percent field holds one value, so
hasMany, minRows and maxRows are not accepted. TypeScript rejects them, and setting any of them from JavaScript fails at startup.
Invalid options fail when the config is built, with an error naming the field:
Admin options
Percent fields support the standard field admin options. These Number field options are accepted but not used, because the percent input is a text input:
FrogBot stores the field’s precision in
admin.custom.frogbot.kind. Your own admin.custom keys, and other keys under admin.custom.frogbot, are kept.
Display and editing
Percentages are formatted in the admin’s selected language.
precision changes only what is shown: 0.425 with precision: 0 shows 43% and is still stored as 0.425.
An empty value shows nothing: no placeholder and no dash. A stored 0 shows as 0%.
Percentages look the same in the List, on Board cards and in Calendar events. If a percent field is the first List column, a row with an empty value has no link to open the document from that column.
In the document view, an editable percent field is a text input with a % sign after it. Type the percentage, and FrogBot saves the fraction: 42.5 saves 0.425, and 7 saves exactly 0.07. The input reads:
- a dot as the decimal separator, such as
42.5or.5, with no thousands separators - an optional trailing
%, so a pasted42%saves0.42 - a leading
-or+
abc or 1,5, shows “Enter a percentage such as 42.5.” on the field when you leave it. That text is never saved: Save and Save Draft leave the field out of the request, so the stored value is kept, and after saving the input shows the stored value again.
The label, description, validation errors, min, max, required and a custom validate work as on a Number field. When the field is read-only, because of admin.readOnly, because it is virtual, or because the user may not update it, the document view shows the formatted percentage as text with no input.
Stored value
Values are stored as fractions:0.42 means 42%, and 1 means 100%. Values above 1 and below 0 are allowed unless you set min or max. The REST API, GraphQL and the Local API read and write the fraction, and the generated TypeScript type is the same as a Number field’s, such as progress?: number | null.
Filters and sorting use the stored value too, so a filter for 50% takes 0.5.
Agents and generated types
A percent field describes itself to agents using FrogBot’s MCP tools and in generated types:admin.description, or a translated one with an en entry, the percent text is added after it in parentheses. The admin panel still shows only your description.
admin.description isn’t copied, so the percent text stands alone. The text is English only.
Generated types show the text as a comment above the property. In the MCP plugin’s create and update tools, min and max also become the value’s minimum and maximum, so agents see the allowed range. Generated types don’t include limits, and virtual fields don’t appear in MCP tool inputs.
To change the text, add your own jsonSchema entry. It runs after the percent field’s entry, so it can adjust or replace the description:
Formatting in your code
formatPercent is the formatter percent fields use. Import it from frogbot/fields, which is safe to use in browser code:
formatPercent returns the formatted string, or '' for an empty value. frogbot/fields also exports the FormatPercentArgs and PercentKind types.
Custom components
The percent cell and input arePercentCell and PercentField from @frogbotai/ui/admin. Your own admin.components.Cell or admin.components.Field replaces them, and other components such as Label, Description, Error, beforeInput and afterInput work with the percent input as they do on a Number field.
A custom Cell can draw the standard percent display inside its own markup with FieldCell, as shown for Money fields. As with any custom Cell, it appears only in the List view. Board cards and Calendar events keep the standard percent display.