Editor and list molecules
The editor and list molecules provide two stable, composition-based surfaces for application content. The editor supports configurable rich content with app-owned layout, while the list family supports feed and table-like workflows with shared row behavior, selection, sorting, responsive columns, and virtualization. See component library for the wider component model and code editor molecule for the separate code-editing surface.
Public molecule boundaries
Subpath exports
The package exposes these molecule families through dedicated subpaths: frappe-ui/editor and frappe-ui/list. Each subpath is a public boundary with its own curated barrel and its own family stylesheet. This keeps the editor's rich editing dependency surface separate from ordinary root imports and lets an application opt into each family as a unit.
The stable editor surface includes the Editor component, the useEditor engine, content and menu building blocks, extension kits, individual extensions, menu items, and toolbar presets. The stable list surface includes the list composition components, the useVirtualRows composable, and the list prop and state types. The experimental ListView is a different product surface and is not the stable list family.
References: package.json• L50-66 src/…/index.ts• L1-17 src/…/index.ts• L27-101 src/…/index.ts• L1-24 src/…/list.md• L1-10
Composition boundaries
The editor owns editor lifecycle and content behavior but does not choose a page layout. The Editor component is renderless: it exposes the live editor and its empty state through a slot, while the application places EditorContent, menus, and action controls where they fit its design. An application can use the same building blocks without Editor by creating the editor with useEditor and passing the editor instance explicitly.
The list family owns collection geometry and row interaction, but it does not own readable cell content or data fetching. Applications provide row content through slots and keep ordering, remote queries, and other business state outside the list. This boundary lets the same list primitives support a feed, a table, a grouped list, or a master-detail surface.
The two families therefore share a composition principle without sharing a data model:
| Family | Library-owned boundary | Application-owned boundary |
|---|---|---|
| Editor | Editor lifecycle, content binding, extension capability, menu behavior, and editor styling | Layout, chosen capabilities, content sources, upload service, and app-specific wrapper components |
| List | Grid geometry, row semantics, selection mechanics, active-row display, and windowing support | Items, row rendering, cell meaning, sort state, navigation targets, and data access |
References: spec/…/0004-editor-family-composition-model.md• L18-27 spec/…/0004-editor-family-composition-model.md• L54-66 src/…/Editor.vue• L39-43 src/…/List.vue• L1-10 src/…/ListRows.vue• L24-47
Editor molecule
Editor lifecycle
The editor flow starts with an extension list and optional content model. Editor creates and destroys the underlying editor, binds HTML, JSON, or Markdown content, and reports change, focus, blur, and transaction events. useEditor is the lower-level choice when an application must own editor creation or compose the building blocks outside the component.
The editor accepts an upload function as a shared service for upload-aware capabilities. The shared media flow can report progress, accept cancellation, keep a failed file available for retry, and write safe upload results back into the document. Collaboration changes the content update path, so an application that enables collaboration must treat the collaboration extension as the owner of synchronized document state.
This flow shows how application content and capability choices become a live editor and then return as content or events.
flowchart LR
A[Application content and options] --> B[Editor or useEditor]
C[Extension kit and custom extensions] --> B
B --> D[Live editor instance]
D --> E[EditorContent]
D --> F[Menu and interaction blocks]
D --> G[Updated content and editor events]
D --> H[Media upload service]
H --> D
References: src/…/Editor.vue• L9-37 src/…/Editor.vue• L45-91 src/…/useEditor.ts• L20-31 src/…/useEditor.ts• L47-63 src/…/useEditor.ts• L91-155 src/…/useEditor.ts• L157-219 src/…/media-upload-engine.ts• L65-135 src/…/media-upload-engine.ts• L168-297 src/…/media-node-ops.ts• L72-160
Extension kits
Extension kits define capability bundles without defining the editor's visual layout. StarterKit supplies common document behavior. CommentKit adds a lighter content set for short-form discussion. RichTextKit extends that base for articles and documents. InlineKit constrains content to one block for titles and names.
Each kit is configurable at the extension level. A member can be configured or removed, and an application can add its own extensions beside the kit. This makes the kit the capability boundary: the chosen extensions decide which content and commands exist, while the component remains the same.
| Kit | Content role | Capability shape |
|---|---|---|
StarterKit | Common document foundation | Basic text, blocks, lists, history, and related editor behavior |
CommentKit | Short-form comments and discussion | Links, media, mentions, tags, and paste support without tables by default |
RichTextKit | Articles, documents, and wiki content | Comment capabilities plus tables, tasks, embeds, headings, commands, and text styling |
InlineKit | Single-line names and titles | One block with a small inline formatting set |
The individual extension exports support more specific composition. Markdown is opt-in through its extension export, so an application that selects Markdown format must also load the Markdown capability.
References: src/…/extensions.ts• L139-172 src/…/kits.ts• L99-137 src/…/kits.ts• L139-179 src/…/kits.ts• L192-250 src/…/kits.ts• L253-304 src/…/extensions.ts• L329-332
Editor building blocks
EditorContent is the content mount and typography boundary. The menu blocks are separate surfaces: EditorFixedMenu renders a persistent menu, EditorBubbleMenu follows a text selection, EditorFloatingMenu supports contextual empty-space actions, and EditorTableMenu provides table actions when table capability is active. EditorDropZone adds a drop target for editor content workflows.
Inside Editor, these blocks can resolve the live editor from provided context. An explicit editor prop still wins, which keeps each block usable as a standalone primitive. This gives a common path for simple application wrappers and a direct path for bespoke layouts.
References: src/…/editor-context.ts• L5-35 src/…/EditorContent.vue• L18-24 src/…/EditorContent.vue• L138-146 src/…/EditorFixedMenu.vue• L7-20 src/…/EditorBubbleMenu.vue• L11-43 src/…/EditorFloatingMenu.vue• L11-43 src/…/EditorTableMenu.vue• L24-37 src/…/index.ts• L17-25
Editor menus
Editor menus use typed MenuItem values instead of forcing a toolbar layout. A menu item describes its label, action, active state, disabled state, and whether the selected editor capability makes it available. Groups and separators allow an application to assemble a menu without copying command logic.
The shared menu renderer tracks editor transactions so active and disabled states follow the current selection. It removes unavailable items and cleans up separators. This means one toolbar preset can adapt to different kits, while the application still controls which preset or individual items it displays.
The exported presets provide starting points rather than complete editor products:
minimalToolbarsupports a small inline editor.commentToolbarsupports common discussion formatting.articleToolbaradds block, media, and table entry points.tableToolbaris a contextual set for table operations and self-prunes when tables are absent.
References: src/…/menu.ts• L19-55 src/…/menu.ts• L78-93 src/…/menu.ts• L244-272 src/…/menu.ts• L347-387 src/…/MenuItems.vue• L15-31 src/…/MenuItems.vue• L68-93
List molecule
List structure
The list family builds a shared grid from List, ListRows, and row content. List supplies the family context. ListHeader changes the outer semantics to a table-like structure. ListRow selects the native interaction form from its route, URL, and click inputs. ListCell, header cells, and groups provide small structural pieces while the application supplies their content. ListGroup adds a labeled row group without breaking the row structure, and it can keep its label visible while the group scrolls.
This diagram shows how the list context connects collection structure, row content, and optional selection or windowing behavior.
flowchart TB
A[List] --> B[ListHeader]
A --> C[ListRows]
A --> D[ListGroup]
B --> E[Header cells and sort controls]
C --> F[ListRow]
F --> G[ListCell or application content]
C --> H[Selection and active-row identity]
C --> I[Optional virtual window]
Without a header, the family presents list and list-item semantics. With a header, it presents table, row, column-header, and cell semantics. The presence of a header is the structural signal, so an application does not need a separate mode prop.
References: src/…/List.vue• L1-10 src/…/List.vue• L23-35 src/…/ListHeader.vue• L2-41 src/…/ListHeader.vue• L63-69 src/…/ListGroup.vue• L1-40 src/…/ListRowBase.vue• L1-10 src/…/ListCell.vue• L1-8
List identity and interaction
ListRows resolves one string identity for each item and sends that identity to the row key, scoped slot, selection set, and active-row model. The default identity is name, then id, then the index. A rowKey field or function is the contract for items that use another identity.
Selection and active state are separate interaction surfaces. selectable reveals the checkbox column and makes a row click toggle selection instead of following its route or URL. v-model:active tracks one open or highlighted row while preserving the row's own click handler or navigation behavior. A row with route is a router link, a row with href is a native link, a row with a click handler is a button, and a non-interactive row remains a plain element. The row uses one click path for selection and navigation so selection can prevent navigation reliably.
The header select-all state uses the complete ListRows item set, not only mounted rows. This keeps selection behavior correct when the list is virtualized or when some rows are outside the viewport. The header exposes one keyboard-accessible select-all control, so the visual checkbox remains part of the list interaction rather than a second control.
References: src/…/ListRows.vue• L24-47 src/…/ListRows.vue• L78-107 src/…/List.vue• L31-48 src/…/List.vue• L132-175 src/…/ListRow.vue• L5-31 src/…/ListRow.vue• L48-69 src/…/ListHeader.vue• L10-33
List columns and sorting
The list uses one grid template for the header and every row. An array gives one template at every width. A breakpoint map gives a complete template for each supplied application breakpoint, with base as the narrow-width template. Each breakpoint replaces the whole template, so changes in track count must be paired with matching cell visibility rules.
Column switching follows the consuming app's Tailwind screens. This keeps list geometry and responsive cell classes in step, including custom screen definitions. A key that is not an app screen is ignored and produces a development warning. Deterministic track sizes are important for table-like alignment because each row is its own grid.
Sorting is controlled by the application. ListHeaderCellSort supplies a real button, sort semantics, a direction indicator, and a click event. It also supports leading content and a custom sort indicator while keeping the label position stable when a column is inactive. The application owns the sort state and decides whether it changes local data or a remote list query.
References: src/…/types.ts• L6-36 src/…/types.ts• L38-63 src/…/List.vue• L52-74 src/…/List.vue• L78-129 tailwind/listColumns.js• L1-13 src/…/ListHeaderCell.vue• L1-26 src/…/ListHeaderCellSort.vue• L1-20 src/…/ListHeaderCellSort.vue• L57-108
List virtualization
Virtual rows reduce mounted row work for large collections while keeping the application's scroll container. ListRows virtual requires a fixed item height from List.rowHeight or its own itemHeight; it then renders rows near the visible window and adds an overscan band. The exported useVirtualRows composable supports cases where the application needs the windowing behavior without the ListRows wrapper.
Virtualization changes which rows are mounted, not which items exist. The full item set still feeds identity and select-all state, while the virtual window controls only the visible row rendering.
References: src/…/ListRows.vue• L35-75 src/…/ListRows.vue• L78-89 src/…/useVirtualRows.ts• L11-23 src/…/useVirtualRows.ts• L25-64
Shared picker interaction
Picker shell
PickerShell gives picker controls one trigger and panel contract. It combines the library's labeled TextInput with a manually controlled Popover, while still allowing an application-specific trigger and panel content. This shared surface lets picker components reuse opening, closing, focus, typing, and display-value behavior instead of defining separate interaction rules.
The shell exposes three models: panel open state, raw input text, and whether the user is typing. Focus and click can open the panel when enabled. The default text trigger keeps focus for typing, while a custom trigger asks the parent to move focus into the panel after a gesture. The shell also keeps a blur caused by moving into the portalled panel from ending the picker interaction.
The picker contract is useful to table workflows that need a shared choice or date panel beside list controls. A parent can open or close a picker through its template-ref surface and can focus either the default input or the first focusable element in a custom trigger. The shared trigger slot receives the open state, disabled state, display label, raw input value, and open/close actions. See input controls for the input contract and overlays and navigation for the panel behavior.
When a panel opens, the shell connects the trigger's combobox relationship to the panel and emits an open event. When a panel closes after focus was inside it, the default input regains focus. A shell that starts open does not move page focus, because the open state came from the parent rather than from a user gesture.
References: src/…/PickerShell.vue• L1-60 src/…/PickerShell.vue• L76-111 src/…/PickerShell.vue• L117-167 src/…/PickerShell.vue• L178-224 src/…/PickerShell.vue• L226-243 src/…/types.ts• L8-24 src/…/types.ts• L58-101
Shared styling and type contracts
Package styles
Each molecule subpath imports its family stylesheet from its public barrel. Editor styles establish the content surface, placeholders, media selection, tables, task lists, and editor popup motion. List styles establish grid geometry, row padding, dividers, checkbox placement, hover surfaces, and active-row surfaces. Applications should import the public subpath rather than relying on an unrelated component stylesheet.
The styles use the library's semantic design tokens. The list family exposes --list-gap and --list-row-padding-x as public geometry hooks. Internal --_list-* variables carry component state and column resolution; applications should not depend on them. Shared picker controls inherit the input and overlay styles from their composed controls, so their visual contract follows the input and popover surfaces rather than a separate picker theme. See layout and feedback for the wider surface rules.
References: src/…/index.ts• L1-4 src/…/index.ts• L1-3 src/…/style.css• L4-25 src/…/style.css• L1-12 src/…/style.css• L106-129 src/…/PickerShell.vue• L1-60
Tabs and tree interaction
Shared tab and tree surfaces extend the same composition model into navigation around tabular workflows. Pill renders labels, icons, prefixes, and suffixes without owning the active indicator; its parent tab track can move that indicator without changing the pill's size. TreeItem keeps expansion, focus, drag state, and drop position in the tree context while allowing the application to replace the full item or only parts of its label.
This boundary keeps state and content separate. The shared surface provides stable roles and state markers, while the application supplies labels, adornments, and custom row content. An icon-only pill remains accessible when a label is supplied, and a fully replaced tree item makes the application responsible for its own visual state.
References: src/…/Pill.vue• L8-29 src/…/Pill.vue• L58-94 src/…/Pill.vue• L111-139 src/…/TreeItem.vue• L1-17 src/…/TreeItem.vue• L35-77 src/…/TreeItem.vue• L120-167
Type contracts
The editor contract centers on content format, extension capability, upload results, editor events, and typed menu actions. Upload results require a safe file_url, while upload requests can carry abort and progress hooks. The list contract centers on column templates, divider treatment, row identity, sort direction, selection models, active-row models, and fixed-height virtualization. The picker contract centers on trigger placement, panel placement, labeled input state, slot data, open and close events, and template-ref control. These types describe the handoff between the library and an application; they do not describe the application's data records or business rules.
The most important contract pairs are:
- Editor
extensionswith kit and extension exports. - Editor
formatwith the matching content value and optional Markdown extension. - Menu
isAvailablewith the capability present in the editor schema. - Media
UploadFunctionresults with the requiredfile_urland optional progress or abort request data. - List
rowKeywithvalue, selection, and active-row state. - List
columnswith matching header and row cell visibility. - List
rowHeightoritemHeightwith virtual windowing. - List sort
directionwitharia-sort, the visible indicator, and the application-owned ordering state. - Picker
open,inputValue, andtypingmodels with trigger and panel behavior. - Picker
displayLabelandinputValuewith the custom trigger's rendered value and editing state. - Picker
requestFocuswith the parent-owned focus target inside the panel. - Tab pill icon-only intent with visible slot content and the accessible label supplied by the caller.
References: src/…/useEditor.ts• L20-54 src/…/Editor.vue• L13-37 src/…/menu.ts• L21-46 src/…/media-upload-types.ts• L42-119 src/…/media-upload-types.ts• L121-163 src/…/types.ts• L22-36 src/…/types.ts• L38-81 src/…/types.ts• L84-123 src/…/ListHeaderCellSort.vue• L4-20 src/…/types.ts• L54-82 src/…/types.ts• L85-101 src/…/PickerShell.vue• L85-111 src/…/Pill.vue• L23-29
Change checklist
When these files or sections are changed, remember to consider these:
- Keep src/…/index.ts and package.json aligned when adding or removing stable editor exports.
- Keep editor kit defaults, individual extension exports, menu availability checks, and toolbar presets aligned so a preset does not advertise a capability that a kit does not load.
- Keep the editor content format contract aligned across
Editor,useEditor, and the Markdown extension requirement. - Keep the upload result and request types aligned with the shared media engine, image and video extensions, and host upload handlers. A change to retry, cancellation, or progress behavior must preserve the staged-file lifecycle.
- Keep media node writes tied to the current editor view after asynchronous work. A captured view can become stale while an upload or dimension probe is in progress.
- Keep
ListRowsidentity resolution aligned withListselection and active-row state. A change in one identity path can silently break select-all or highlighted rows. - Keep
ListRowroute, URL, click, selection, and active-row handling on one click path. A change can silently allow navigation during selection or stop an application click handler from running during activation. - Keep
Listcolumn templates aligned with the TailwindlistColumnsplugin and with responsive cell visibility classes. - Keep fixed row-height requirements aligned between
List,ListRows, anduseVirtualRows; a variable-height virtual list can render the wrong scroll positions. - Keep
ListGrouprow-group structure and sticky label behavior aligned with list divider and scroll styles. - Keep public list CSS hooks and
data-slotstate markers aligned with the family stylesheet when changing row geometry or interaction states. - Keep
ListHeaderCellSortdirection,aria-sort, indicator slots, and application sort state aligned when changing header behavior. - Keep
PickerShellopen-state models, focus events, and thePickerExposedref surface aligned with picker consumers. A change in custom-trigger focus behavior can strand keyboard focus in the trigger or panel. - Keep the picker panel id and combobox relationship aligned with the popover content element when changing the overlay wrapper or portalling behavior.
- Keep tab pill active-indicator ownership and icon-only slot detection aligned with the parent tab track and its accessible label rules.
- Keep tree item slot ownership aligned with tree state markers. A full
itemoverride also takes ownership of the row's visual hover and selected surfaces.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
Importing editor capabilities but omitting them from extensions | The content or menu action is unavailable, or a preset removes the item | Pass a kit or the required individual extensions and rely on menu availability checks |
Selecting format: 'markdown' without the Markdown extension | Markdown content cannot be parsed or exported as intended | Import and include Markdown in the editor extensions |
Returning an upload result without a safe file_url | The media node cannot receive a usable source and the upload is marked as failed | Return a safe file_url and let the shared engine validate it |
| Destroying or replacing the editor view during an upload | A late write can target a dead or stale document | Resolve the current view for each write and use the engine's alive checks |
Using a list rowKey that is not stable or unique | Selection, active-row display, and Vue row reuse target the wrong item | Use a stable application identity and expose it through value |
| Enabling virtual rows without a fixed row height | Virtualization is disabled and a warning appears, or the window cannot match scroll space | Set List.rowHeight or virtual.itemHeight |
Naming a columns breakpoint that is not in the consuming Tailwind screens | The template is ignored and the list keeps the lower breakpoint template | Use the app's screen names and keep the frappe-ui Tailwind preset active |
| Changing column track count without hiding matching cells | Header and row content no longer represent the same columns | Pair every responsive track change with matching header and row visibility classes |
| Loading list or editor components without their public family stylesheet | Structural layout or editor content styling is incomplete | Import from frappe-ui/editor or frappe-ui/list so the family styles load |
Using selectable with a row route or URL and expecting the click to navigate | The row click selects the row and prevents navigation | Treat selection as the higher-priority row click behavior and provide a separate navigation action when needed |
Opening a picker with a custom trigger without handling requestFocus | The panel opens but keyboard focus stays outside the picker content | Move focus into the panel when the shell requests it |
| Treating a blur into the portalled picker panel as a real blur | Typing state ends while the user is still interacting with the picker | Keep the panel inside the shell's focus relationship and use its open/close events |
| Changing the popover content element without updating the picker panel id lookup | The combobox points to no panel or to a stale panel id | Keep the shell's aria-controls value synchronized with the rendered popover content |
| Supplying visible pill slot content with icon-only assumptions | The visible label can be hidden or the accessible name can differ from the rendered content | Let the pill's default slot cancel icon-only treatment and provide a label when the icon needs a name |
| Fully overriding a tree item without rendering its state surfaces | Hover, focus, or drop state is not visible even though the tree state remains active | Treat the full item slot as ownership of the row presentation and render needed state yourself |
Key files
| File | Why to read it |
|---|---|
| package.json | Shows the stable editor and list package entrypoints. |
| src/…/index.ts | Defines the curated editor export surface and loads editor styles. |
| src/…/Editor.vue | Shows the renderless editor boundary and lifecycle-facing contract. |
| src/…/useEditor.ts | Shows content formats, editor events, uploads, collaboration handling, and lifecycle ownership. |
| src/…/media-upload-engine.ts | Shows the shared media upload lifecycle, retry behavior, progress, cancellation, and safe write-back. |
| src/…/media-upload-types.ts | Defines the upload function, result, request, and engine contracts. |
| src/…/media-node-ops.ts | Shows the document-side placeholder, success, error, and dimension operations. |
| src/…/kits.ts | Defines the configurable capability bundles. |
| src/…/menu.ts | Defines typed menu actions and toolbar presets. |
| src/…/editor-context.ts | Defines how building blocks resolve an editor instance. |
| src/…/types.test.ts | States the compile-time guarantees for kit, upload, menu, and suggestion option contracts. |
| src/…/index.ts | Defines the curated list export surface and loads list styles. |
| src/…/List.vue | Defines list context, models, semantics, and collection-level behavior. |
| src/…/ListRows.vue | Defines item identity, scoped row composition, select-all coverage, and virtualization entry. |
| src/…/ListRow.vue | Defines route, URL, click, selection, and active-row interaction boundaries. |
| src/…/ListGroup.vue | Defines labeled row groups and optional sticky group headers. |
| src/…/ListHeader.vue | Defines table-header semantics and the keyboard-accessible select-all control. |
| src/…/ListHeaderCell.vue | Defines the basic column-header composition surface. |
| src/…/ListHeaderCellSort.vue | Defines controlled sorting behavior, semantics, and indicator extension points. |
| src/…/types.ts | Defines the main list columns, row, sorting, and virtualization contracts. |
| src/…/useVirtualRows.ts | Defines windowing against an application-owned scroll container. |
| src/…/style.css | Defines shared list geometry and public CSS hooks. |
| tailwind/listColumns.js | Defines responsive column resolution against the consuming app's screens. |
| src/…/PickerShell.vue | Defines the shared picker trigger, panel, focus, and open-state boundary. |
| src/…/types.ts | Defines picker props, slot data, and template-ref contracts. |
| src/…/Popover.vue | Defines the shared overlay behavior used by the picker shell. |
| src/…/TextInput.vue | Defines the labeled input and focus surface used by the default picker trigger. |
| src/…/Pill.vue | Defines tab label composition, icon-only intent, sizing, and active-state boundaries. |
| src/…/TreeItem.vue | Defines tree item semantics, expansion, focus, drag state, and slot ownership. |