Introducing a new way to review your PRs.

Read the announcement

frappe / frappe-ui

The all-in-one toolkit for modern frontends. High-quality components, app recipes and AI-ready docs.

View on GitHub

28 documents · Updated Nov 23, 2026

docs / editor-and-list-molecules

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:

FamilyLibrary-owned boundaryApplication-owned boundary
EditorEditor lifecycle, content binding, extension capability, menu behavior, and editor stylingLayout, chosen capabilities, content sources, upload service, and app-specific wrapper components
ListGrid geometry, row semantics, selection mechanics, active-row display, and windowing supportItems, 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.

KitContent roleCapability shape
StarterKitCommon document foundationBasic text, blocks, lists, history, and related editor behavior
CommentKitShort-form comments and discussionLinks, media, mentions, tags, and paste support without tables by default
RichTextKitArticles, documents, and wiki contentComment capabilities plus tables, tasks, embeds, headings, commands, and text styling
InlineKitSingle-line names and titlesOne 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:

  • minimalToolbar supports a small inline editor.
  • commentToolbar supports common discussion formatting.
  • articleToolbar adds block, media, and table entry points.
  • tableToolbar is 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 extensions with kit and extension exports.
  • Editor format with the matching content value and optional Markdown extension.
  • Menu isAvailable with the capability present in the editor schema.
  • Media UploadFunction results with the required file_url and optional progress or abort request data.
  • List rowKey with value, selection, and active-row state.
  • List columns with matching header and row cell visibility.
  • List rowHeight or itemHeight with virtual windowing.
  • List sort direction with aria-sort, the visible indicator, and the application-owned ordering state.
  • Picker open, inputValue, and typing models with trigger and panel behavior.
  • Picker displayLabel and inputValue with the custom trigger's rendered value and editing state.
  • Picker requestFocus with 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 ListRows identity resolution aligned with List selection and active-row state. A change in one identity path can silently break select-all or highlighted rows.
  • Keep ListRow route, 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 List column templates aligned with the Tailwind listColumns plugin and with responsive cell visibility classes.
  • Keep fixed row-height requirements aligned between List, ListRows, and useVirtualRows; a variable-height virtual list can render the wrong scroll positions.
  • Keep ListGroup row-group structure and sticky label behavior aligned with list divider and scroll styles.
  • Keep public list CSS hooks and data-slot state markers aligned with the family stylesheet when changing row geometry or interaction states.
  • Keep ListHeaderCellSort direction, aria-sort, indicator slots, and application sort state aligned when changing header behavior.
  • Keep PickerShell open-state models, focus events, and the PickerExposed ref 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 item override also takes ownership of the row's visual hover and selected surfaces.

Important failure modes

TriggerConsequenceGuard
Importing editor capabilities but omitting them from extensionsThe content or menu action is unavailable, or a preset removes the itemPass a kit or the required individual extensions and rely on menu availability checks
Selecting format: 'markdown' without the Markdown extensionMarkdown content cannot be parsed or exported as intendedImport and include Markdown in the editor extensions
Returning an upload result without a safe file_urlThe media node cannot receive a usable source and the upload is marked as failedReturn a safe file_url and let the shared engine validate it
Destroying or replacing the editor view during an uploadA late write can target a dead or stale documentResolve the current view for each write and use the engine's alive checks
Using a list rowKey that is not stable or uniqueSelection, active-row display, and Vue row reuse target the wrong itemUse a stable application identity and expose it through value
Enabling virtual rows without a fixed row heightVirtualization is disabled and a warning appears, or the window cannot match scroll spaceSet List.rowHeight or virtual.itemHeight
Naming a columns breakpoint that is not in the consuming Tailwind screensThe template is ignored and the list keeps the lower breakpoint templateUse the app's screen names and keep the frappe-ui Tailwind preset active
Changing column track count without hiding matching cellsHeader and row content no longer represent the same columnsPair every responsive track change with matching header and row visibility classes
Loading list or editor components without their public family stylesheetStructural layout or editor content styling is incompleteImport 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 navigateThe row click selects the row and prevents navigationTreat 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 requestFocusThe panel opens but keyboard focus stays outside the picker contentMove focus into the panel when the shell requests it
Treating a blur into the portalled picker panel as a real blurTyping state ends while the user is still interacting with the pickerKeep 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 lookupThe combobox points to no panel or to a stale panel idKeep the shell's aria-controls value synchronized with the rendered popover content
Supplying visible pill slot content with icon-only assumptionsThe visible label can be hidden or the accessible name can differ from the rendered contentLet 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 surfacesHover, focus, or drop state is not visible even though the tree state remains activeTreat the full item slot as ownership of the row presentation and render needed state yourself

Key files

FileWhy to read it
package.jsonShows the stable editor and list package entrypoints.
src/…/index.tsDefines the curated editor export surface and loads editor styles.
src/…/Editor.vueShows the renderless editor boundary and lifecycle-facing contract.
src/…/useEditor.tsShows content formats, editor events, uploads, collaboration handling, and lifecycle ownership.
src/…/media-upload-engine.tsShows the shared media upload lifecycle, retry behavior, progress, cancellation, and safe write-back.
src/…/media-upload-types.tsDefines the upload function, result, request, and engine contracts.
src/…/media-node-ops.tsShows the document-side placeholder, success, error, and dimension operations.
src/…/kits.tsDefines the configurable capability bundles.
src/…/menu.tsDefines typed menu actions and toolbar presets.
src/…/editor-context.tsDefines how building blocks resolve an editor instance.
src/…/types.test.tsStates the compile-time guarantees for kit, upload, menu, and suggestion option contracts.
src/…/index.tsDefines the curated list export surface and loads list styles.
src/…/List.vueDefines list context, models, semantics, and collection-level behavior.
src/…/ListRows.vueDefines item identity, scoped row composition, select-all coverage, and virtualization entry.
src/…/ListRow.vueDefines route, URL, click, selection, and active-row interaction boundaries.
src/…/ListGroup.vueDefines labeled row groups and optional sticky group headers.
src/…/ListHeader.vueDefines table-header semantics and the keyboard-accessible select-all control.
src/…/ListHeaderCell.vueDefines the basic column-header composition surface.
src/…/ListHeaderCellSort.vueDefines controlled sorting behavior, semantics, and indicator extension points.
src/…/types.tsDefines the main list columns, row, sorting, and virtualization contracts.
src/…/useVirtualRows.tsDefines windowing against an application-owned scroll container.
src/…/style.cssDefines shared list geometry and public CSS hooks.
tailwind/listColumns.jsDefines responsive column resolution against the consuming app's screens.
src/…/PickerShell.vueDefines the shared picker trigger, panel, focus, and open-state boundary.
src/…/types.tsDefines picker props, slot data, and template-ref contracts.
src/…/Popover.vueDefines the shared overlay behavior used by the picker shell.
src/…/TextInput.vueDefines the labeled input and focus surface used by the default picker trigger.
src/…/Pill.vueDefines tab label composition, icon-only intent, sizing, and active-state boundaries.
src/…/TreeItem.vueDefines tree item semantics, expansion, focus, drag state, and slot ownership.