onFocus so your app can run custom logic — navigation, uploads, etc.
Decorator model
| Property | Type | Description |
|---|---|---|
action | String? | Non-empty and unique among decorators at the same path. |
icon | String? | Icon name (see Supported icons). |
label | String? | Text shown next to or instead of the icon. |
color | String? | 6-digit hex color: #RRGGBB (e.g. #3B82F6). |
icon or label (isDisplayable). Action-only entries are stored but not displayed.
Constructing a path
DocumentEditor resolves decorators using a slash-separated path. Every path starts with pageId/fieldPositionId. What you append after that determines what gets decorated.
Reserved keywords. The path grammar uses three reserved tokens —schemas,rows, andcolumns. Anything else in a path slot is treated as an id (page id, field-position id, row id, column id, or schema key). Don’t use these keywords as ids.
Field decorators
Just the two ids. Applies to the field’s header.Table — /rows, /columns/colId, or specific rowId / rowId/colId
A table has four decorator scopes, two common (defaults applied everywhere) and two specific (overrides for one row or cell):
| What you want | Append | Example |
|---|---|---|
| Common decorators on every row | /rows | pageId/fpId/rows |
| Decorators on one specific row | /rowId | pageId/fpId/row_42 |
| Common decorators on every cell in a column | /columns/colId | pageId/fpId/columns/col_status |
| Decorators on one specific cell | /rowId/colId | pageId/fpId/row_42/col_status |
/rows shows on row_42 until you write to row_42 directly.
Collection — same as table, plus /schemas/schemaKey/… for nested rows
A collection’s root rows behave like a table — the four scopes above use the exact same path shapes.
Take a “People” collection where each person row holds a nested “Addresses” schema:
schemas/schemaKey/…, no parent walk needed:
| What you want | Path shape | Example |
|---|---|---|
| Common rows in any schema | pageId/fpId/schemas/sk/rows | pageId/fpId/schemas/addresses/rows |
| Common columns in any schema | pageId/fpId/schemas/sk/columns/colId | pageId/fpId/schemas/addresses/columns/col_zip |
schemas/sk/, then the nested row id:
| What you want | Path shape | Example |
|---|---|---|
| Specific nested row | …/rowId/schemas/sk/nestedRowId | pageId/fpId/p_alice/schemas/addresses/addr_home |
| Specific nested cell | …/rowId/schemas/sk/nestedRowId/colId | pageId/fpId/p_alice/schemas/addresses/addr_home/col_zip |
addresses itself had children, you’d chain another schemas/.../rowId/… after addr_home — the same pattern repeats for every level.
Schema keys come from the field’sschemamap. The schema markedroot: trueholds top-level rows; itschildrenarray names the nested schemas reachable from a row in this schema.
API
Four methods, all ondocumentEditor.decorators. Errors are reported via onError as JoyfillError.DecoratorError(DecoratorError).
Behavior to know
- Copy-on-write seed. First write to a row-self / cell scope seeds from the matching common scope, so existing common decorators stay visible on that row alongside your override. Subsequent writes diverge freely.
-
Collection license gating. Writes against a collection field require a license that enables collection features. Without it, the call emits
decoratorErrorand is rejected.
Handling taps
Decorator taps come throughonFocus with the decorator’s action exposed on the field event’s type / target. rowIds / columnId / parentPath on FieldIdentifier tell you where the user tapped.
Errors
All four APIs report throughonError as JoyfillError.DecoratorError(DecoratorError):
- Path didn’t resolve (bad ids, deleted row, malformed grammar)
- Validation (
actionempty,colornot#RRGGBB) - Duplicate
actionin batch or against an existing entry remove/updatewith an unknownaction- Collection write without a valid license
get) on an unresolvable path also emit onError and return [].
Display limits
DecoratorConfig, passed to DocumentEditor at init, controls how many decorators render inline before the rest collapse into a kebab menu.
Supported icons
The SDK maps common names to bundled artwork, including:camera, import, paperclip, image, file, comment, comments, upload, download, rotate, cloud, filter, share, paper-plane, folder, folder-open, magnet, eye, circle-info, add, plus, print, flag. Unknown names fall back to a default symbol.