Introducing a new way to review your PRs.

Read the announcement

ohif / viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages

View on GitHub

21 documents · Updated Nov 23, 2026

docs / shared-ui-components

Shared UI components

The platform UI packages provide the common presentation layer for the viewer. They turn viewer state and user intent into consistent controls, study views, panels, viewport chrome, dialogs, and status surfaces. The established @ohif/ui package works beside the newer @ohif/ui-next package during the transition described in next-generation UI components; the wider viewer relationship is described in viewer UI system.

Package boundary

The shared UI surface is split between an established package and a newer package. Both are reusable React libraries, and the application presents them as platform-level building blocks rather than as feature-owned screens.

Established component library

@ohif/ui supplies the earlier viewer component set. It covers basic controls, input and filter fields, tables, study-list parts, typography, icons, context menus, and empty states. Its public entry point also exposes icon registration and shared types so older application and extension code can use the same presentation vocabulary. The package is published as a reusable React library at version 3.14.0-beta.101 and requires Node 24 or newer for its package tooling. References: platform/…/package.json• L1-28, platform/…/index.js• L1-34, platform/…/index.js• L1-51

The package remains important where a consumer still uses its study-list or table contracts. The application’s legacy work-list route is the clearest bridge between the established components and the newer package. References: platform/…/LegacyWorkList.tsx• L1-41

Next-generation component library

@ohif/ui-next is the main shared presentation surface for current viewer work. It brings small controls and larger viewer surfaces under one public boundary, including study browsing, thumbnails, tool buttons, viewport parts, panels, dialogs, menus, progress displays, and data views. It also exports the providers, types, hooks, and utilities that let those surfaces share viewer state. References: platform/…/package.json• L1-29, platform/…/index.ts• L1-7, platform/…/index.ts• L1-322

The two packages are not separate product areas. They are two generations of the same UI role, so a feature should use the package that matches its surrounding composition and avoid creating a third local visual contract. References: platform/…/App.tsx• L18-30, platform/…/LegacyWorkList.tsx• L22-41

Presentation building blocks

The libraries provide a progression from simple controls to viewer-specific surfaces. This lets a feature express its intent through shared presentation without taking ownership of common focus, feedback, selection, or visual state.

Common controls

Common controls cover actions, data entry, selection, navigation, feedback, and short-lived overlays. Buttons, inputs, labels, tabs, toggles, menus, tooltips, cards, tables, dialogs, and popovers form the base language that larger viewer surfaces reuse. The established package also provides filter input behavior and document-level tooltip presentation for consumers that still use its component set. References: platform/…/index.ts• L15-58, platform/…/index.ts• L159-226, platform/…/Button.tsx• L7-58, platform/…/Input.tsx• L5-25, platform/…/InputFilterText.tsx• L15-19, platform/…/PortalTooltip.tsx• L9-15

These controls carry shared visual states such as active, disabled, focused, selected, and destructive. A feature can change the content and callback while keeping those states recognizable across the work list, viewer, side panels, and extension tools. Filter fields can notify consumers as the value changes or after a short delay, while portal tooltips keep transient help separate from the local layout. References: platform/…/Button.tsx• L7-31, platform/…/Tabs.tsx• L23-51, platform/…/ToolButton.tsx• L8-29, platform/…/InputFilterText.tsx• L20-53, platform/…/PortalTooltip.tsx• L29-50

Viewer surfaces

Viewer surfaces join the common controls to imaging tasks. Study browsers and thumbnails support study selection and display-set movement; tool buttons express viewer actions; viewport parts provide overlays, action areas, patient information, and image navigation; panels organize feature content beside the image area. References: platform/…/index.ts• L228-313, platform/…/index.ts• L1-9, platform/…/ToolButton.tsx• L30-131, platform/…/SidePanel.tsx• L184-198

The surfaces do not decide which imaging data a feature should show. They expose points for the host application, extensions, and modes to provide data, commands, content, or service-backed state. This keeps presentation reusable when a mode changes the workflow or an extension adds a new imaging capability. References: platform/…/index.ts• L25-52, platform/…/ViewportPane.tsx• L10-19, platform/…/ViewportGrid.tsx• L202-207

Layout primitives

Layout primitives define the space in which viewer surfaces work. The viewport grid provides the image area, viewport panes mark active and drop-ready regions, side panels hold feature tabs, and resizable panels let the application place those regions around the grid. References: platform/…/ViewportGrid.tsx• L4-20, platform/…/ViewportPane.tsx• L6-9, platform/…/Resizable.tsx• L9-40, platform/…/SidePanel.tsx• L7-16

The viewer assembles these primitives into a header, optional left and right panels, and a central viewport area. A mode supplies the desired panel and viewport composition, while the layout presents that composition without owning the mode’s clinical workflow. References: extensions/…/index.tsx• L14-31, extensions/…/index.tsx• L152-222

The following flow shows how a mode and its extensions shape a screen through shared presentation building blocks.

flowchart LR
  M[Mode composition] --> X[Extension modules]
  X --> L[Shared layout primitives]
  L --> C[Shared controls and viewer surfaces]
  C --> S[Viewer services and state]
  S --> V[Rendered work list or viewer]

References: platform/…/Mode.tsx• L235-274 extensions/…/index.tsx• L150-220 platform/…/index.ts• L159-322

Consumer relationships

The application, extensions, and modes consume the UI packages at different levels. The application owns the provider and route boundaries, extensions add feature content and actions, and modes choose the screen composition that brings those parts together.

Application composition

The application mounts the shared providers around the routed viewer. This gives controls and surfaces access to common theme, notification, dialog, modal, viewport-grid, cine, authentication, drag-and-drop, and image-viewer context before routes and extension content render. References: platform/…/App.tsx• L104-143, platform/…/index.ts• L1-26

The application also supplies the service instances behind those providers. As a result, a shared component can present a service-owned action or state without creating a private path that bypasses the viewer system. References: platform/…/App.tsx• L104-128, platform/…/ViewportGridProvider.tsx• L488-549

Extension consumption

Extensions use the shared packages to add panels, toolbar actions, viewport overlays, dialogs, menus, and workflow-specific controls. They provide the feature content and connect events to viewer services, while the UI package supplies the common presentation and interaction rules. References: extensions/…/ViewerHeader.tsx• L1-10, extensions/…/PanelStudyBrowser.tsx• L1-6, extensions/…/ViewportWindowLevel.tsx• L1-4, extensions/…/USAnnotationPanel.tsx• L1-24

Extensions can also consume layout and viewport primitives directly. A display-set drop enters through a shared viewport pane, and the host application then decides how to update viewer state or apply a customization. References: platform/…/ViewportPane.tsx• L22-34, platform/…/ViewportGrid.tsx• L152-169

Mode consumption

Modes describe the screen a workflow needs rather than drawing that screen themselves. A mode names its layout, panels, viewport types, toolbar composition, and extension dependencies; the route loads those modules and passes the resulting composition to the shared layout. References: modes/…/index.tsx• L23-40, modes/…/index.tsx• L256-311, modes/…/index.tsx• L313-372, platform/…/Mode.tsx• L446-469

This relationship makes modes a policy layer over reusable presentation. When a mode changes its panel list or viewport arrangement, the same side-panel and viewport primitives can present the new workflow. When an extension adds a panel or toolbar action, it can use the existing shell instead of replacing the whole layout. References: platform/…/Mode.tsx• L258-290, extensions/…/index.tsx• L164-217

Styling assets

The styling assets give both UI generations a shared visual base. They include the Inter font, Tailwind utilities, semantic color tokens, status colors, sizing rules, and small global behavior rules used by the components and their consumers.

Token-based styling

The newer package styles components with semantic CSS variables such as background, foreground, primary, muted, border, input, ring, and chart colors. Components refer to these roles instead of hard-coding a color for each surface, so one theme can change the whole viewer in a single visual system. References: platform/…/tailwind.css• L1-55, platform/…/Button.tsx• L7-18, platform/…/Dialog.tsx• L86-118

The established package supplies the same broad token idea and shared utility rules for consumers that still use its components. The application Tailwind setup scans both package source trees and their extension and mode consumers, which keeps utility classes available across the composed viewer. References: platform/…/tailwind.css• L1-30, platform/…/tailwind.config.js• L9-19

Theme presets

Theme presets change the shared token set at the document level. The current theme provider supports the default appearance, named tonal or neutral presets, and a visitor-local custom theme; components then inherit the selected roles without feature code changing its markup. References: platform/…/index.ts• L8-16, platform/…/themes.css• L1-8, platform/…/ActiveThemeProvider.tsx• L98-115

The default extension registers the active theme provider only when the theme customization is enabled. This makes theme selection an optional platform capability while keeping the component contract available to consumers that opt into it. References: extensions/…/init.ts• L22-31, platform/…/ActiveThemeProvider.tsx• L117-162

Font and style loading

ThemeWrapper loads the newer package’s Tailwind and asset styles without adding a visual wrapper. The application mounts it near the top of the provider tree, so shared styles are present for routed screens, extension components, and mode layouts. References: platform/…/ThemeWrapper.tsx• L1-5, platform/…/App.tsx• L114-128

The shared assets also define small cross-component rules. These include the Inter font, disabled presentation, text truncation, number-input treatment, and the base page behavior needed by a full-screen viewer. References: platform/…/tailwind.css• L1-29, platform/…/tailwind.css• L210-266

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to either package’s public entry point must preserve imports used by the application and extensions. Review platform/…/index.js, platform/…/index.ts, and the package export declarations together.
  • Changes to the @ohif/ui package contract must keep its published package boundary, React peer contract, Node runtime requirement, released version, and Rspack build entry point aligned with the package build and its consumers.
  • Changes to layout primitives must preserve the contracts between mode layout data, ViewerLayout, ViewportGrid, ViewportPane, and the viewport-grid service.
  • Changes to theme token names must stay aligned across the base Tailwind CSS, preset CSS, component class names, and the application Tailwind scan paths.
  • Changes to drag-and-drop presentation must keep the data type and drop target aligned between thumbnails, viewport panes, and the application’s drop handler.
  • Changes to compound study-list composition must preserve the table and preview relationship used by the work list and any customization that replaces its columns or preview.
  • Changes to provider-backed components must preserve the service supplied by the application and the matching context hook used by extensions.

Important failure modes

TriggerConsequenceGuard
A mode names a layout or viewport module that its loaded extensions do not provideThe viewer cannot resolve the screen component and the mode route fails before the viewer is usableKeep mode module references and extension dependencies aligned
A component token is removed from the base theme or a named presetA control can lose its contrast or visual state when the user changes themeTreat token names as a contract across component classes and all theme sources
A viewport pane accepts a different drag type from the thumbnail or other sourceThe user cannot place a display set through drag and dropKeep the shared drag source and pane target contract aligned
A service-backed provider is mounted without its matching serviceShared UI actions can fail to publish state or can behave as local-only actionsMount providers through the application’s service-backed provider composition
A study list is composed without its required table surfaceThe work-list surface cannot build its main study viewKeep the StudyList.Table part in every study-list composition
A theme customization provides no valid token declarationsThe requested custom appearance is rejected and the prior theme remains activeSupply valid CSS variable declarations for the custom theme boundary

Key files

FileWhy to read it
platform/…/package.jsonDefines the established package boundary, publication contract, runtime baseline, React peer contract, released version, and production build command.
platform/…/rspack.prod.jsShows how the established package produces its reusable JavaScript and CSS library assets.
platform/…/index.jsShows the established package’s public component and type boundary.
platform/…/InputFilterText.tsxShows the established filter input contract for immediate and delayed value changes.
platform/…/PortalTooltip.tsxShows the established portal tooltip surface for transient help outside the local layout.
platform/…/index.tsShows the newer package’s public components, providers, types, hooks, and utilities.
platform/…/index.tsGroups the current controls, viewer surfaces, dialogs, panels, and layout primitives.
platform/…/index.tsShows the shared state and service-provider boundary used by the application and extensions.
platform/…/ViewportPane.tsxShows the presentation boundary for active viewports and display-set drops.
platform/…/SidePanel.tsxShows how feature tabs appear beside the viewport area.
extensions/…/index.tsxShows how the application shell combines the header, panels, resizers, and viewport grid.
platform/…/Mode.tsxShows how mode and extension composition becomes a routed viewer layout.
platform/…/ViewportGrid.tsxShows how application state selects and renders shared viewport panes.
platform/…/App.tsxShows the provider and style boundary around the full application.
platform/…/ActiveThemeProvider.tsxShows named-theme and custom-theme behavior at a platform level.
platform/…/tailwind.cssDefines the newer package’s shared tokens and global style rules.
platform/…/tailwind.config.jsShows how package, extension, and mode styles enter the application build.