Pantrix UI

The rules of an adaptive interface

The rules by which an interface written with Pantrix fits its window; what to look at while writing a screen or a component, what changes and what stays, and what the library does today.

An interface written with Pantrix is the same code on Android, iOS, the desktop and the web. This page gives the rules by which that interface fits its window: what to look at while writing a screen or a component, what changes and what stays the same. Beside each rule is what the library does today.

Three documents complete each other:

DocumentWhat it says
This pageThe rules: what should be done
The adaptive interface guideWhat the library gives: how the API works
Using the adaptive helpersWorked cases: a sign-in screen, a table, showing and hiding

1. Principles

  1. The window, not the device. The layout is chosen by the window's size, not by the kind of device. iPad Split View, a desktop window and a browser tab change their size freely; a foldable that opens becomes a tablet at once. if (platform == Android) is not a layout decision.

  2. The width chooses the layout. The height says whether there is room to stack things. The posture says whether the window is split in two at the hinge.

  3. A screen asks the window, a component asks its own box. A screen asks PantrixTheme.window. A component does not know where it will be put: it asks the place it is given (BoxWithPantrixWindow).

  4. Finger or mouse: ask the input, not the platform. A browser on a phone is a web too, and a touch kiosk is a desktop.

  5. The content is called from one place. When the window changes, the layout around the content changes; the content stays where it is and keeps its state (the choice, the scroll, the text typed).

2. Window classes

Width

ClassWidth (dp)Where it is seenMarginGutter
Compact< 600A phone, a foldable's cover screen, a narrow browser window1616
Medium600–839A tablet held upright, an open foldable, iPad Split View2416
Expanded840–1199A tablet held sideways, a phone held sideways2424
Large1200–1599A desktop window, a browser3224
ExtraLarge≥ 1600A wide desktop window, an external display3224

The bounds are Android's window size classes (600 / 840 / 1200 / 1600). A product can give the theme bounds of its own; the numbers of this page are then read as its numbers.

Height

ClassHeight (dp)Where it is seen
Compact< 480A phone held sideways, a low desktop or browser window
Medium480–899A phone held upright, a tablet held sideways
Expanded≥ 900A tablet held upright, a desktop window

A phone held sideways comes out Expanded by its width (iPhone 17: 874 × 402 dp), but it has no room upward: every bar laid across takes a seventh of the screen. The rule of a short window (while the height is Compact):

Today: heightClass, byHeight(...), isShort. PantrixScaffold puts the navigation at the side by the width, so it is at the side on a phone held sideways. The menu, the date picker and the supporting pane go by the width too: a phone held sideways is Expanded by its width, so there the menu is a popover and the supporting pane a panel at the side (section 10). They do not look at the height besides: a window both short and Compact in width still opens the menu as a sheet from the bottom.

3. Layout measures

4. Foldable postures

PostureHow it is toldRule
Closed (the cover screen)The window is Compact, with no hingeThe same as a phone's layout. On opening, the same screen goes on, with the same choice and the same scroll.
Open, flatThere is a hinge, the screen is one pieceIts class's layout. There is no need to keep clear of the hinge.
BookHalf open, the hinge uprightTwo panels part exactly at the hinge; nothing comes over the hinge.
TabletopHalf open, the hinge acrossThe upper half is for what is looked at; controls, forms and navigation are in the lower half.

What tells of the hinge:

PlatformSourceState
AndroidJetpack WindowManager (FoldingFeature)Read
WebThe browser's Device Posture and Viewport Segments APIs (Chromium)Read
iOSUIKit, from iOS 27.1 on: reserved regions (.division, .occlusion) and UIHingeInteractionRead. Flat on an older iOS.
DesktopNoneFlat

An app that reads the hinge itself gives the posture to the theme: rememberPantrixWindow(posture = …).

5. Input

PlatformSmallest touch target
Android48 dp
iOS44 pt
Web, with a mouse32 dp
Web, by touch48 dp
Desktop32 dp; 48 dp where the app says it is touched

6. Components

7. Showing and hiding

By whatWhenHow
The windowDo not show it where there is no roomwindow.isNarrow, byWidth(...)
The inputWhere it makes sense only by finger, or only with a mouseplatform.isTouch
The platformWhere it exists on that platform alone (such as a store link)platform.type

8. Continuity and state

9. Theme

10. What changes with the size

The table gives the library's components' defaults today. The scaffolds look at their own place, not at the window; a menu and a date picker look at the window they open over.

ElementCompactMediumExpandedLarge and up
Navigation (PantrixScaffold)A navigation bar at the bottomA rail at the sideA rail at the side; a sidebar from 1088 dpA sidebar at the side
The page's title (PantrixPageScaffold, PageTitlePlacement.Adaptive)In the top barIn the top barAt the top of the content, largeAt the top of the content, large
List and detail (PantrixListDetailScaffold)One panel; the detail opens in the list's placeOne panel; the detail opens in the list's placeThe list and the detail side by sideSide by side; the extra panel beside them too
Supporting pane (PantrixSupportingPaneScaffold)A sheet from the bottomA sheet from the endA panel at the sideA panel at the side
A row's menu, a date picker (OverlayPresentation.Adaptive, DatePickerPresentation.Adaptive)A sheet from the bottomA popoverA popoverA popover
A confirmation (PantrixDialog)A dialog in the middleA dialog in the middleA dialog in the middleA dialog in the middle
The page's actions (PantrixPageScaffold's actions)In the header, as their icons; what does not fit in the "…" menuIn the header, with their labelsIn the header, with their labelsIn the header, with their labels

11. What there is today

SubjectState
The window, the classes, the helpersThere
The layout measures (margin, gutter, count of columns, widest content)There
A component's own box (BoxWithPantrixWindow)There
Touch targets, a touch browserThere
Posture: Android, the web and iOS (from 27.1 on)There
Two panels, the count of panels, the hinge's place in a nodeThere
Scaffold: the navigation's place, the tabletop postureThere
Inheriting in a nested themeThere
Navigation componentsThere
The list and detail scaffold, the supporting pane, the tabletop layoutThere
Sheets and menus that adapt, layers at the hingeThere
The system's vertical bar (the iPhone Duo's cover screen): the navigation's and the top bar's buttons in the columnThere

Sources