Viewer UI system
The viewer UI system is the shared presentation layer for OHIF. It provides the viewer shell, reusable controls, shared state boundaries, and common visual rules for study work and image viewing. It has an established package and a next-generation package that support current workflows while the viewer moves toward a newer component model.
System boundary
The UI system sits between the application host and viewer features. The host supplies routes, services, commands, data, and provider context. UI components turn those inputs into visible controls and surfaces without owning the rules for study retrieval or image display.
References: platform/…/App.tsx• L104-143 platform/…/Mode.tsx• L446-469 platform/…/package.json• L1-29 platform/…/package.json• L1-29
Viewer shell
The viewer shell is the set of shared surfaces that frame user work. It includes the header, study list, image viewport area, tools, panels, dialogs, notices, and loading feedback. The application composes these surfaces around the active route and mode. A mode can therefore change the viewing workflow without rebuilding the common UI boundary.
References: platform/…/App.tsx• L114-181 platform/…/LegacyWorkList.tsx• L554-604 platform/…/Mode.tsx• L455-469
UI package boundary
The package manifests define public React entry points and build outputs for consuming features. The established package is published as @ohif/ui at version 3.14.0-beta.101 and supports React 18.3.1 through React 19. The next-generation package is published as @ohif/ui-next, requires React 19.2.7, and exposes named component, library, and Tailwind configuration paths. Feature code should use these public boundaries instead of internal file paths.
References: platform/…/package.json• L1-29 platform/…/package.json• L1-29 platform/…/package.json• L75-78 platform/…/index.js• L1-34 platform/…/index.ts• L1-7
Package generations
The two UI packages represent related stages of the viewer UI model. The established package supports existing viewer workflows. The next-generation package targets React 19 and offers a more composable surface with direct component and library entry paths. The established package requires Node.js 24 or later.
References: platform/…/package.json• L1-29 platform/…/package.json• L1-14 platform/…/package.json• L75-78
Established UI package
The established UI package provides the older shared control and worklist surface. Its main role is to support existing viewer paths with buttons, inputs, selection controls, typography, tables, filters, pagination, expandable study rows, tooltips, and context menus. Its filter input can report changes at once or after a short delay. This lets worklists balance direct feedback with fewer filter actions. Read Shared UI components for the package-level component model and its established conventions.
References: platform/…/package.json• L1-8 platform/…/index.js• L3-34 platform/…/index.js• L1-51 platform/…/InputFilterText.tsx• L6-18 platform/…/PortalTooltip.tsx• L15-21 platform/…/LegacyWorkList.tsx• L14-41
Next-generation UI package
The next-generation UI package provides the newer shared surface for controls, study browsing, viewport chrome, overlays, dialogs, tools, feedback, and viewer state. Its public component surface includes both basic controls and viewer-specific surfaces. Newer workflows can therefore share one visual and interaction model. It uses compound components and context providers so a feature can replace one part of a surface while keeping the surrounding behavior. Its public package boundary exposes the main API plus named component, library, and Tailwind configuration paths. Read Next-generation UI components for its detailed component and provider contracts.
References: platform/…/package.json• L9-14 platform/…/index.ts• L1-147 platform/…/index.ts• L160-323 platform/…/index.ts• L1-26 platform/…/index.ts• L1-7
Coexistence model
The application uses the next-generation package for the main provider stack and current viewport and worklist surfaces. Legacy routes still use established controls. Those controls also use selected next-generation pieces such as icons and date inputs. The package boundary is therefore a migration seam rather than a hard split between two complete applications.
References: platform/…/App.tsx• L19-30 platform/…/ViewportGrid.tsx• L1-5 platform/…/WorkList.tsx• L9-18 platform/…/LegacyWorkList.tsx• L14-41 platform/…/StudyListFilter.tsx• L5-9 platform/…/InputFilterText.tsx• L1-5
Shared viewer behavior
The UI system keeps behavior that crosses many components in shared context and service boundaries. This prevents each control or layout from creating a private version of viewport state, feedback, dialogs, or interaction rules.
References: platform/…/App.tsx• L104-143 platform/…/index.ts• L1-26
Provider composition
Provider composition supplies the viewer tree with the state needed by its surfaces. The application places theme, authentication, localization, viewport, dialog, modal, notification, tooltip, cine, and extension contexts around the routes. The active mode adds image-viewer and drag-and-drop context around its layout. A component can request shared behavior through a hook while the host keeps ownership of the related service.
References: platform/…/App.tsx• L114-143 platform/…/Mode.tsx• L440-469 platform/…/index.ts• L1-26
Viewport interaction
Viewport UI organizes the image area into panes and connects pane interaction to viewer state. A pane can become active, accept display-set drops, show action and patient overlays, and report readiness. The host chooses the concrete viewport content for the display sets assigned to that pane.
References: platform/…/ViewportGrid.tsx• L128-169 platform/…/ViewportGrid.tsx• L249-315 platform/…/ViewportPane.tsx• L6-76 platform/…/index.ts• L1-9
The viewport grid is the UI face of the platform viewport service. Layout changes, active-pane changes, display-set assignment, and readiness events can therefore reach the rest of the viewer through the same boundary.
References: platform/…/ViewportGridProvider.tsx• L123-154 platform/…/ViewportGridProvider.tsx• L431-454 platform/…/ViewportGridProvider.tsx• L493-544
Transient feedback
Dialogs, modals, and notifications give services and extensions a shared way to ask for user attention. The providers render the current feedback surface and install matching actions into platform services when the host supplies them. Feature code can then focus on the event and its message instead of a specific overlay implementation.
References: platform/…/DialogProvider.tsx• L12-29 platform/…/DialogProvider.tsx• L41-110 platform/…/ModalProvider.tsx• L4-16 platform/…/ModalProvider.tsx• L51-97 platform/…/NotificationProvider.tsx• L186-225
Study and tool surfaces
The shared surfaces support the two main user tasks around an imaging session: find the right study and act on the visible content. Study-list surfaces organize query results and optional previews. Tool surfaces present commands with a common active, toggled, disabled, and tooltip state.
References: platform/…/WorkList.tsx• L127-182 platform/…/ToolButton.tsx• L30-131
Study browsing
The current study list is a compound surface with one table and an optional preview panel. The table owns study selection, filtering, sorting, pagination, loading, and workflow launch callbacks. Its filter row supports date-range and modality choices while leaving other columns to the shared table behavior. A double-click selects the study before it launches a supplied callback or the applicable default workflow. The layout owns the split between the table and preview. This contract lets the application add toolbar actions and preview content without taking over the list frame.
References: platform/…/Layout.tsx• L24-109 platform/…/Table.tsx• L24-87 platform/…/WorkList.tsx• L132-182
Tool controls
Tool controls give viewer commands a shared visual and interaction language. A tool can expose an icon or custom content, a label and tooltip, active or toggled state, disabled guidance, and an interaction callback that carries the tool identity and command data. The control reports intent. The viewer command system decides what that intent does.
References: platform/…/ToolButton.tsx• L30-44 platform/…/ToolButton.tsx• L66-112 platform/…/Mode.tsx• L440-469
Tool settings
Tool settings turn feature options into a common set of rows inside viewer tool panels. The setting surface supports scalar ranges, double ranges, segmented choices, buttons, checks, switches, selects, and custom content. The feature keeps ownership of the value and change callback.
Numeric controls provide one shared contract for number fields, single ranges, double ranges, and steppers. Typed values remain drafts until the user commits them with Enter or by leaving the field. Invalid drafts return to the last valid value. Double ranges can also permit typed values outside the starting slider limits when the setting enables that behavior.
References: platform/…/ToolSettings.tsx• L12-63 platform/…/ToolSettings.tsx• L84-137 platform/…/RowSegmentedControl.tsx• L7-74 platform/…/RowDoubleRange.tsx• L6-63 platform/…/Numeric.tsx• L23-126 platform/…/Numeric.tsx• L165-305 platform/…/Numeric.tsx• L307-574 platform/…/DoubleSlider.tsx• L7-16 platform/…/DoubleSlider.tsx• L87-140
Header composition
The next-generation header frames the viewer with a return action, brand or site logo, a secondary slot, centered content, ordered right-side slots, and a settings menu. This slot model lets the host add workflow-specific content without changing the shared navigation frame. Empty right-side slots also remove their separators.
References: platform/…/Header.tsx• L18-39 platform/…/Header.tsx• L41-135
Composition conventions
Compound components keep related layout parts under one parent contract. StudyList accepts a table and an optional preview. Its preview container accepts a header and content. Invalid child shapes fail early. This protects the visual relationship between a surface and the state that controls it.
References: platform/…/index.ts• L25-52 platform/…/Layout.tsx• L50-75 platform/…/PreviewContainer.tsx• L10-39
Styling model
The styling model gives both packages a dark viewer-oriented visual language with shared utility classes and CSS tokens. Components use semantic token names for surfaces, text, borders, actions, status colors, and focus states. A theme can therefore change the palette without changing each component.
References: platform/…/tailwind.css• L32-104 platform/…/tailwind.css• L7-83
Shared visual tokens
CSS variables define the values consumed by utility classes. The established package and the next-generation package each load their own style entry point. A change to a shared visual concept must stay aligned across both token sets when a surface can appear in both package generations.
References: platform/…/tailwind.css• L32-104 platform/…/tailwind.css• L7-83 platform/…/ThemeWrapper.tsx• L1-5
Theme variants
The next-generation package extends the base token set with named theme presets and a local custom-theme option. A named theme changes the document token class. Custom values are stored for the local visitor and applied as token declarations. The viewer can therefore offer appearance choices without requiring feature components to know the palette.
References: platform/…/index.ts• L8-16 platform/…/themes.css• L1-8 platform/…/ActiveThemeProvider.tsx• L98-115 platform/…/ActiveThemeProvider.tsx• L138-187
UI request flow
The UI flow starts with host and viewer state, passes through shared context, and ends with a visible surface or a service-backed action. This diagram shows how the application keeps layout and data decisions outside reusable controls while still giving those controls a path back to viewer behavior.
flowchart LR
A[Application and mode] --> B[Platform services and viewer state]
B --> C[UI providers and hooks]
C --> D[Shared shell surfaces]
D --> E[User interaction]
E --> F[Callback or service action]
F --> B
The boundary is important because a reusable UI component should express an action or display state, not recreate the viewer's command, data, or layout policy. The host and platform services remain the source of truth. The UI packages provide the common means to show and change that state.
References: platform/…/App.tsx• L104-143 platform/…/ViewportGrid.tsx• L152-169 platform/…/ViewportGridProvider.tsx• L524-544 platform/…/ToolButton.tsx• L93-110
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to either package's public exports must be checked against application imports and extension-facing consumers.
- Changes to provider placement must preserve access to the service context needed by dialogs, modals, notifications, and extension content.
- Changes to viewport pane interaction must keep active-pane events, display-set drop data, readiness reporting, and viewport service updates aligned.
- Changes to
StudyListchild composition must preserve the one-table and optional-preview contract used by the current worklist. - Changes to study-row selection or double-click behavior must preserve selection before launch and the fallback from a default workflow to the first applicable workflow.
- Changes to token names or values must stay aligned between both package style entry points and the next-generation theme presets.
- Changes to icons, date controls, filter inputs, or header slots in
@ohif/ui-nextmust account for established-package components and host compositions that consume them. - Changes to numeric control modes or value handling must preserve the callback and draft-value contract shared by
Numeric,DoubleSlider, and tool setting rows. - Changes to tool setting types or option shapes must keep
ToolSettingsand its row components aligned with feature-supplied settings. - Changes to package exports, runtime constraints, or dependencies must be checked against the package build and the application package that consumes the public entry point.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A package export is removed or renamed | The application or an extension fails at its import boundary | Treat both package entry points as public contracts and check their consumers together |
| A service-backed provider is mounted without its matching service | UI actions do not publish the expected viewer state or feedback | Keep provider registration and service setup in the same host composition path |
A StudyList omits its required table or adds an unsupported child | The study list rejects the composition and does not render | Keep the table as the single required child and place preview content in the preview slot |
| A study double-click launches before selecting the row or changes workflow fallback order | The worklist can open the wrong study state or fail to start the expected workflow | Preserve selection before launch and resolve the supplied callback, default workflow, then first applicable workflow in that order |
| A viewport drop type or interaction callback changes on only one side | Display sets cannot be placed or the active viewport does not update | Review the viewport host and pane contract as one interaction path |
| A token exists in one style set but not the other | A shared control loses its color or contrast in one package generation or theme | Update the base token maps and all affected presets together |
| An established control relies on a changed next-generation icon or date control | A legacy worklist surface breaks even though its own package did not change | Include cross-package imports in the impact review |
| A header slot or settings option changes without its host contract | Site-specific header content disappears or its action no longer runs | Review header consumers with the slot order and menu option shape |
| A tool setting type or option shape has no matching row contract | The setting is skipped or its value change does not reach the feature | Keep the setting type map and row callback shape aligned |
| Numeric input commits drafts during typing or accepts invalid values | A tool changes its value before the user finishes an edit or receives unusable data | Preserve commit-on-Enter-or-blur behavior and restore the last valid value |
| A double-range typed bound changes without its slider bound contract | The displayed range and the setting value disagree | Keep typed expansion, clamping, and lower-to-upper ordering rules together |
| A tooltip portal is replaced while its old root remains mounted | A stale tooltip node can remain in the document or receive later renders | Keep grouped portal ownership, delayed hide cleanup, and deferred root teardown aligned |
| A package engine or dependency requirement moves beyond the consuming environment | Package build or application install fails before the UI loads | Check package constraints against the workspace runtime and application dependency graph |
Key files
| File | Why to read it |
|---|---|
| platform/…/App.tsx | Shows how the application installs the shared UI providers around the routed viewer. |
| platform/…/Mode.tsx | Shows how a mode receives the shared viewport and interaction context. |
| platform/…/ViewportGrid.tsx | Shows how application viewer state becomes viewport panes and user interactions. |
| platform/…/WorkList.tsx | Shows the current worklist composition with the next-generation study-list surface. |
| platform/…/LegacyWorkList.tsx | Shows the established worklist path and its use of both package generations. |
| platform/…/package.json | Defines the established package boundary, React peer range, Node.js runtime requirement, dependency boundary, and package build contract. |
| platform/…/index.js | Defines the established package's public component boundary. |
| platform/…/InputFilterText.tsx | Shows the established filter input contract and its link to the next-generation icon surface. |
| platform/…/PortalTooltip.tsx | Shows the established tooltip surface and its document-level overlay lifecycle. |
| platform/…/tailwind.css | Defines the established package's base styling tokens and shared utility rules. |
| platform/…/package.json | Defines the next-generation package's React 19 peer range, public entry paths including Tailwind configuration, dependency boundary, and package build contract. |
| platform/…/index.ts | Defines the next-generation package's public boundary for components, providers, types, hooks, and utilities. |
| platform/…/index.ts | Shows the main next-generation surface groups and public exports. |
| platform/…/Header.tsx | Shows the shared header slots, return action, site branding, and settings menu contract. |
| platform/…/index.ts | Shows the shared viewer state and service-provider surface. |
| platform/…/ToolSettings.tsx | Shows how feature setting descriptions become common viewer tool rows. |
| platform/…/Numeric.tsx | Shows the shared value contract for number, range, and stepper controls. |
| platform/…/DoubleSlider.tsx | Shows the double-range interaction used by numeric tool settings. |
| platform/…/RowDoubleRange.tsx | Shows how a double-range setting connects tool values to the shared numeric control. |
| platform/…/RowSegmentedControl.tsx | Shows the shared row pattern for labeled segmented choices. |
| platform/…/Layout.tsx | Shows the compound layout contract for the study table and preview. |
| platform/…/Table.tsx | Shows study-table filters, selection behavior, and workflow launch callbacks. |
| platform/…/ViewportGridProvider.tsx | Shows the boundary between viewport UI state and the platform viewport service. |
| platform/…/ActiveThemeProvider.tsx | Shows named theme selection and the local custom-theme boundary. |
| platform/…/tailwind.css | Defines the next-generation base tokens and utility styling model. |