Next-generation UI components
The ui-next component system is OHIF’s modern reusable interface layer for viewer features. It provides shared controls, imaging surfaces, viewer state boundaries, and theme rules so features use one visual and interaction model. It works beside the established shared UI components as the viewer adopts the newer system. It is one part of the broader viewer UI system.
Component system
The component system exposes small controls and viewer-level surfaces through one public interface. Its scope covers common interaction controls, study browsing, viewport chrome, tool settings, data tables, segmentation panels, and image-index navigation. Providers, shared types, hooks, and utilities extend the same interface to stateful viewer features.
References: platform/…/index.ts• L1-7 platform/…/index.ts• L1-323
Primitive controls
Primitive controls establish the shared interaction language for viewer features. They cover actions, selection, navigation, feedback, data entry, overlays, and layout while using accessible interaction patterns for compound controls.
References: platform/…/index.ts• L15-58 platform/…/Button.tsx• L7-58
Numeric controls
Numeric controls present single values, ranges, double ranges, and stepped values through one composition model. Text entry keeps an unfinished draft until a commit point, then checks bounds and restores the last valid value when needed. Double-range controls keep the two values ordered and can support typed values beyond the first visible range when the feature allows it.
References: platform/…/Numeric.tsx• L23-35 platform/…/Numeric.tsx• L54-125 platform/…/DoubleSlider.tsx• L74-140 platform/…/DoubleSlider.tsx• L179-224
Viewer feature surfaces
Viewer feature surfaces connect common controls to imaging workflows. Study browsers and thumbnails support study selection and display-set browsing. Study-browser sorting reads the available sort choices and the last applied display-set sort, then sends criterion and direction changes back to the display-set service. Viewport surfaces frame the active image area and its actions. Headers and tool buttons provide navigation and command surfaces. These components pass user intent to the viewer through callbacks and shared context rather than deciding viewer data or command policy.
References: platform/…/StudyBrowser.tsx• L11-85 platform/…/StudyBrowserSort.tsx• L11-45 platform/…/StudyItem.tsx• L9-95 platform/…/ThumbnailList.tsx• L19-87 platform/…/ViewportPane.tsx• L6-76 platform/…/ToolButton.tsx• L30-131 platform/…/Header.tsx• L18-39
Data tables
DataTable provides a shared surface for viewer lists that need sorting, filtering, paging, column visibility, and row selection. Feature wrappers supply domain columns, filters, row actions, and workflow behavior while the table keeps the surrounding interaction model consistent. The StudyList table identifies studies by their study instance UID, derives modality filter choices from its rows, supports date and modality filters, and can launch the selected study’s default or first applicable workflow on double-click.
References: platform/…/DataTable.tsx• L69-89 platform/…/DataTable.tsx• L124-180 platform/…/DataTable.tsx• L397-517 platform/…/Table.tsx• L24-86 platform/…/Table.tsx• L111-247
Segmentation panels
SegmentationTable provides a shared panel for segmentation data and display actions. It gives the host control of its configuration surface while keeping display mode, opacity, outline, and inactive-segmentation choices in one feature-facing contract.
References: platform/…/SegmentationTable.tsx• L18-34 platform/…/SegmentationTable.tsx• L44-85 platform/…/SegmentationTableConfig.tsx• L10-37 platform/…/SegmentationTableConfig.tsx• L39-192
Scroll position controls
SmartScrollbar provides shared index navigation for image-heavy views. It maps pointer and optional keyboard input to a bounded position and can show the current position within a larger image set. Its indicator is part of the required composition so users can see that position.
References: platform/…/SmartScrollbar.tsx• L13-27 platform/…/SmartScrollbar.tsx• L103-141 platform/…/SmartScrollbar.tsx• L194-269
Tool settings
ToolSettings turns viewer tool options into a consistent settings surface. The option model supports ranges, double ranges, discrete choices, custom content, buttons, checks, switches, and selects. Each option can be conditional and reports changes through its callback, so the surface presents tool state without owning tool policy.
References: platform/…/ToolSettings.tsx• L12-63 platform/…/ToolSettings.tsx• L84-137 platform/…/ToolSettings.tsx• L139-251 platform/…/RowDoubleRange.tsx• L6-63 platform/…/RowSegmentedControl.tsx• L7-73
Compound composition
Compound components group related parts behind a small composition contract. StudyList requires a table and permits an optional preview, while SegmentationTable groups segmentation rows with its settings surface. This lets a viewer feature replace one part without losing the shared layout and state behavior.
References: platform/…/index.ts• L25-52 platform/…/Layout.tsx• L39-109 platform/…/Layout.tsx• L117-212 platform/…/SegmentationTable.tsx• L25-34 platform/…/SegmentationTable.tsx• L158-167
Viewer state boundaries
The provider layer shares viewer state across components and connects that state to platform services. Providers own state that crosses component boundaries, while their hooks give child features a stable way to read it or request changes. The shared boundaries cover viewport grids, image-viewer study context, dialogs, notifications, drag and drop, cine playback, authentication, icons, and themes.
References: platform/…/index.ts• L1-26
Viewport grid state
The viewport grid provider coordinates the panes that make up an imaging layout. It links active panes, layout shape, display sets, readiness, and hanging-protocol state to ViewportGridService, so layout changes remain part of the viewer’s shared state rather than local component state.
References: platform/…/ViewportGrid.tsx• L4-19 platform/…/ViewportGridProvider.tsx• L24-63 platform/…/ViewportGridProvider.tsx• L122-154 platform/…/ViewportGridProvider.tsx• L487-549
Dialog and notification state
Dialog and notification providers turn transient viewer events into reusable feedback. A host or service can request modal content or notifications without depending on one visual surface. Notifications can also suppress repeated errors within a time window.
References: platform/…/ModalProvider.tsx• L4-16 platform/…/ModalProvider.tsx• L40-97 platform/…/NotificationProvider.tsx• L23-40 platform/…/NotificationProvider.tsx• L186-225
Interaction context
Interaction context keeps cross-cutting presentation rules consistent across feature controls. Icon presentation supplies a shared size and container contract. Image-viewer context supplies the studies for an image-viewing scope. Other providers expose shared actions such as drag and drop and cine control.
References: platform/…/IconPresentationProvider.tsx• L5-18 platform/…/IconPresentationProvider.tsx• L53-88 platform/…/ImageViewerProvider.tsx• L3-16 platform/…/index.ts• L9-24
Session-scoped state
useSessionStorage bridges temporary viewer state across a page view without turning it into a long-term user preference. A feature can mark a value for unload cleanup while allowing it to return when a hidden page becomes visible again.
References: platform/…/useSessionStorage.tsx• L3-27 platform/…/useSessionStorage.tsx• L35-69
Theme and style model
The style model gives components one token-based visual language. Utility classes consume shared CSS variables for surfaces, text, borders, actions, status colors, and focus rings. ThemeWrapper loads these styles for a consuming surface without adding another visual container.
References: platform/…/tailwind.css• L7-55 platform/…/tailwind.css• L212-266 platform/…/ThemeWrapper.tsx• L1-5
Theme presets
Theme presets provide full visual variants instead of isolated component overrides. The active-theme provider applies a named preset to the document or restores custom token values. A supported URL theme can set the initial choice, while local storage preserves the selected or custom theme for later visits.
References: platform/…/index.ts• L8-16 platform/…/themes.css• L1-8 platform/…/ActiveThemeProvider.tsx• L5-23 platform/…/ActiveThemeProvider.tsx• L98-115
Custom theme boundary
Custom themes accept CSS variable declarations for the system’s root and dark token sets. The provider stores the source locally and injects it as a temporary style element. This keeps custom appearance local to the visitor and prevents a URL from claiming a custom theme that another visitor cannot reproduce.
References: platform/…/ActiveThemeProvider.tsx• L45-96 platform/…/ActiveThemeProvider.tsx• L138-162 platform/…/ActiveThemeProvider.tsx• L164-187
Build and package boundary
The package boundary turns the public component interface into a reusable browser library. The production build uses src/index.ts as its module entry and emits the UMD bundle named by main as dist/ohif-ui-next.umd.js. React and React DOM remain peer dependencies so the consuming application supplies the shared runtime. Tailwind scans package source and reuses the established UI preset while adding the next-generation layer’s tokens and font scale.
The package’s current contract keeps the root source entry public, exposes selected component and library subpaths, publishes the distribution output and README, and provides development, watch, and production build commands. The package test script is intentionally not a test runner; it exits with an error because no package test command is defined. The package is currently version 3.14.0-beta.101, which identifies this published UI contract as a newer beta than the prior 3.14.0-beta.98 release. Its TypeScript project includes the source tree and provides local aliases for the UI source and core package during development.
References: platform/…/package.json• L2-39 platform/…/package.json• L76-96 platform/…/rspack.prod.js• L15-52 platform/…/tailwind.config.js• L1-9 platform/…/tailwind.config.js• L44-119 platform/…/tsconfig.json• L1-12
Public imports
Consumers should use the root package export for the supported component, provider, type, hook, and utility interface. Selected subpaths are available for Tailwind configuration, library helpers, and components, but the public boundary keeps feature code independent from the internal file layout.
References: platform/…/package.json• L8-13 platform/…/index.ts• L1-7 platform/…/index.ts• L146-154 platform/…/index.ts• L315-323
Platform service integration
Some providers adapt React state to platform services. The viewport grid publishes layout and readiness actions through ViewportGridService, while notification and modal providers can install their actions into matching services or render host-supplied components. Viewer features should use these provider and service contracts for shared behavior.
References: platform/…/ViewportGridProvider.tsx• L493-544 platform/…/NotificationProvider.tsx• L48-52 platform/…/NotificationProvider.tsx• L191-195 platform/…/ModalProvider.tsx• L69-78
Component test boundary
Focused component tests protect the user-facing value contracts for numeric controls. They cover draft input, commit boundaries, invalid values, bounds, range order, and controlled updates. The shared Jest setup maps static assets to src/…/fileMock.js, but the package test script does not run these tests.
References: platform/…/DoubleSlider.test.ts• L33-232 platform/…/Numeric.test.ts• L52-124 platform/…/fileMock.js• L1-7 jest.config.base.js• L15-20 platform/…/package.json• L32-39
Change checklist
When these files or sections are changed, remember to consider these:
- Keep root exports and package subpath exports aligned across platform/…/index.ts and platform/…/package.json.
- Keep theme token names aligned across platform/…/tailwind.config.js, platform/…/tailwind.css, and every preset in
platform/ui-next/src/themes/. - Preserve provider service contracts and event paths when changing service-backed providers.
- Keep display-set drag data aligned with the viewport drop target.
- Preserve the required table and optional preview structure when changing
StudyListcomposition. - Keep the header slot order and separator behavior stable for its right-side content.
- Keep study-browser detail customization aligned across
StudyBrowser,ThumbnailList, andThumbnail. - Keep study-browser sort choices aligned with the sort state applied by
displaySetService. - Keep package
main,module, andexportsfields aligned with the production bundle and source entry point. - Preserve the distinction between production build commands and the package test command. The package test command is not a test runner.
- Keep React peer dependency ranges compatible with the consuming application.
- Keep static asset imports compatible with the shared Jest mapping and platform/…/fileMock.js.
- Keep numeric modes, range value shapes, and tool-setting row values aligned across their shared contracts.
- Preserve the link between visible slider bounds, accepted typed bounds, and empty-input reset behavior.
- Keep segmented option values aligned with their selected values and rendered triggers.
- Keep table state aligned with feature filters, paging, selection, and workflow actions.
- Keep study row identity, selection on click, and workflow launch behavior aligned when changing
StudyListrow actions. - Keep study date and modality filter values aligned with the table’s column IDs and row data.
- Preserve the controlled and internal
showConfigpaths in the segmentation panel. - Keep segmentation display changes aligned for active and inactive representations.
- Preserve the required scrollbar indicator and its relation to item count and selected index.
- Route viewport layout, display-set, readiness, and active-pane changes through
ViewportGridService. - Preserve the hidden-page restore path when changing session storage cleanup.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A component uses a token missing from the base theme or a preset | The control can lose color or contrast when the theme changes | Keep token sets aligned across the Tailwind map, base CSS, and preset CSS |
| A display set sends drag data that the pane does not accept | Drag and drop has no valid target | Keep thumbnail drag and pane accept types as one contract |
| A service-backed provider mounts without its required service | UI actions can stay local or fail to publish viewer state | Mount the provider with the service that owns its contract |
A consumer omits the required StudyList.Table child | The study list does not render | Keep one table child in every StudyList layout |
| A custom theme has no accepted CSS variable declarations | The active appearance does not change | Supply valid --name: value token declarations |
| A numeric draft is treated as a value on every keystroke | Users cannot safely clear or replace a value | Keep draft text separate from the committed numeric value |
| A double-range update puts the lower value above the upper value | The interval becomes invalid | Preserve lower-to-upper ordering on commit |
| A segmented option has no matching trigger | The control cannot show the active choice | Keep option and trigger values in one value set |
| A package entry field points to a file the build does not emit | Consumers cannot load the UI library | Keep package entry fields aligned with bundle output |
| A consumer invokes the package test script as a test runner | The command exits without checking component behavior | Run focused tests through the repository Jest setup |
| A viewport grid action bypasses the grid service | Other viewer systems miss the layout or readiness change | Route shared grid actions through ViewportGridService |
| A session value is cleared when the page only becomes hidden | A returning viewer loses temporary state | Restore marked values on visibility return and clear them only for unload behavior |
| The package declares incompatible React peer versions | The library can load a second React runtime or fail during install or render | Keep peer ranges aligned with the supported React runtime |
| The study-browser sort picker starts from a choice that differs from the applied display-set sort | The control label does not describe the thumbnail order | Initialize the picker from the display-set sort and apply later changes through the display-set service |
| A study row double-click launches without the selected row state | The workflow can start with a stale or unclear study selection | Select the row before invoking the override or applicable workflow |
| A table filter uses a value shape that does not match its column | The study list cannot filter by date or modality correctly | Keep date ranges and modality arrays aligned with the table column contracts |
Key files
| File | Why to read it |
|---|---|
| platform/…/index.ts | Shows the package’s top-level public boundary. |
| platform/…/index.ts | Shows the viewer-facing component groups and exports. |
| platform/…/index.ts | Shows the shared state and service-provider surface. |
| platform/…/Numeric.tsx | Shows the shared value model for numeric controls. |
| platform/…/DoubleSlider.tsx | Shows the double-range interaction contract. |
| platform/…/ToolSettings.tsx | Shows how viewer tool options map to reusable controls. |
| platform/…/Layout.tsx | Shows compound composition for the study table and preview workflow. |
| platform/…/Table.tsx | Shows study filtering, row selection, and workflow launch behavior. |
| platform/…/StudyBrowser.tsx | Shows how study data becomes a browser surface. |
| platform/…/StudyBrowserSort.tsx | Shows how study-browser sort choices stay aligned with display-set order. |
| platform/…/Thumbnail.tsx | Shows the display-set surface and drag behavior. |
| platform/…/DataTable.tsx | Shows the reusable table contract. |
| platform/…/SegmentationTable.tsx | Shows the compound segmentation panel. |
| platform/…/SmartScrollbar.tsx | Shows the image-index navigation contract. |
| platform/…/Header.tsx | Shows the top viewer navigation boundary. |
| platform/…/ViewportGridProvider.tsx | Shows how UI layout state connects to the viewer grid service. |
| platform/…/ActiveThemeProvider.tsx | Shows named-theme selection and the custom-theme boundary. |
| platform/…/tailwind.css | Defines the base visual tokens consumed by components. |
| platform/…/tailwind.config.js | Defines the utility and token mapping used by the package. |
| platform/…/rspack.prod.js | Defines the production library and CSS build boundary. |
| platform/…/tsconfig.json | Defines the source boundary and local TypeScript aliases. |
| platform/…/package.json | Defines package entry points, scripts, dependencies, peer dependencies, and the published build contract. |