Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic

Mobile and native apps

One markup for desktops, tablets and phones. Everything is responsive by default; turn on mobile and phones and tablets get the patterns of a native app instead: a tab bar or rail, a back button, a large title, bottom sheets and pinned actions. It is all web: no native code and no second set of components.

What changes where

Native mode is a mode for touch devices. Desktops look the same in both modes, so one build serves your website, your installed app and your app-store shell.

ScreenResponsive web (default)Native app (mobile)
Desktop
64rem and wider
Sidebar, foldable to icons and remembered; or a labelled rail; or a navigation row above the page. Detail pane as a third column.
Tablet
40 to 64rem
Icon sidebar; the menu button opens the full sidebar over the page. Detail pane is a drawer from the end edge.Labelled rail (icon over label). Back button instead of breadcrumbs. Detail pane beside the page.
Phone
under 40rem
Drawer opened by the menu button. Breadcrumbs. Centred dialogs and anchored dropdowns.Bottom tab bar with “More” when there are over five items. Back button, and the page title moves into the bar as you scroll. Search on its own row. Main actions pinned above the tab bar. Detail pane fills the screen. Bottom sheets.

Sizes follow the width of the window, so a phone turned sideways or a narrow desktop window gets the layout that fits it.

App shell

<pm-app> lays out the navigation, the bar, the page and an optional detail pane, and picks the right navigation for the screen. It never moves or wraps your elements, so it is safe in every framework.

<pm-app mobile collapsible persist="my-app"> <aside class="pm-app-side" aria-label="Workspace"> <a class="pm-brand" href="/"><pm-icon name="zap"></pm-icon><span class="pm-brand-name">Lumen</span></a> <pm-nav label="Main"> <pm-nav-item href="/" label="Overview" icon="home" current></pm-nav-item> <pm-nav-item href="/orders" label="Orders" icon="box" count="12"></pm-nav-item> <pm-nav-item href="/customers" label="Customers" icon="users"></pm-nav-item> </pm-nav> <div class="pm-app-side-footer">…</div> </aside> <div class="pm-app-main"> <pm-app-bar nav-toggle back="/orders"> <pm-input slot="search" type="search" label="Search" hide-label></pm-input> <pm-button slot="end" variant="ghost" icon icon-start="bell" label="Notifications"></pm-button> </pm-app-bar> <main class="pm-app-content"> <h1>Order 1042</h1> … <div class="pm-action-bar"> <pm-button variant="outline">Refund</pm-button> <pm-button>Fulfil order</pm-button> </div> </main> </div> <aside class="pm-app-detail" aria-label="Customer">…</aside> </pm-app>
You writeWhat it does
layout="sidebar | rail | top"Navigation on desktops.
collapsible, persist="name"The bar's menu button folds the sidebar to icons; the choice is remembered under that name.
tablet-nav="rail | sidebar | drawer"Navigation on tablets.
mobile-nav="bar | drawer | none", max-tabs="5"Navigation on native phones, and how many tabs fit before “More”.
app.showDetail(), hideDetail()Open and close the detail pane. Where it covers the page it takes focus, and Esc closes it and returns focus.
<pm-app-bar back="/orders">A back button in native mode (a link, or history back when empty). Cancel pm-back to handle it yourself. show-back="always" shows it on the web too.
<pm-app-bar nav-toggle>The menu button. It shows only where there is something to open or fold.
.pm-action-barThe page's main actions: in the flow on the web, pinned above the tab bar on native phones. Works without the shell too.

The shell reports what it chose: pm-layout-change carries { size, native, nav }, and the element has data-size, data-native and data-nav attributes to style against. The class names alone (class="pm-app" on a div) still give the responsive web layout without JavaScript.

Components in the two modes

Responsive webNative app, on phones
DialogCentred, fits the widthBottom sheet, swipe down to close (mobile-variant="center" or "fullscreen" to change)
Date, time and colour pickers, select, comboboxDropdown kept inside the screenBottom sheet
Menu, context menuAnchored popoverAction sheet with large rows; a long press opens context menus
Nav on its ownSidebarBottom tab bar; parents open a sheet (mobile-variant="sidebar" | "none")
Data tableRows become labelled cards in narrow containers (stack="never" keeps scrolling)
PaginationCollapses to ‹ 5 / 20 ›
Command paletteFull-width top sheet, so the keyboard never covers results
ToastsFull width, swipe sideways to dismiss, sit above the tab bar
ControlsTouch targets of at least 44 px and 16 px input text on touch screens (no zoom on focus); safe-area insets respected

Turn it on

The nearest mobile attribute wins, through shadow roots. mobile="false" opts one area or component out.

<!-- whole app --> <html mobile> <!-- one area --> <section mobile> … </section> <!-- one component --> <pm-date-picker mobile label="Date"></pm-date-picker> <pm-dialog mobile="false" heading="Always centred"></pm-dialog>

Or decide at run time. autoNative() turns native layouts on when the page runs as an installed app or inside a native shell, and leaves the website responsive:

import { autoNative, setMobile } from '@prismora/elements'; autoNative(); // native when installed (home screen, Capacitor, Trusted Web Activity) autoNative('touch'); // native on every touch device setMobile(true); // always: the same as <html mobile>

Add viewport-fit=cover to the viewport meta tag, so the safe-area insets (--pm-safe-top, --pm-safe-bottom) are available. A tab bar publishes its height as --pm-bottom-inset on the root for your own floating elements.

Helpers for app-like pages

Small functions in @prismora/elements/native (also exported from the package root). Each does nothing where the browser lacks the feature, and all are safe during server rendering.

import { isStandalone, syncThemeColor, trackKeyboard, onBack, haptic } from '@prismora/elements/native'; isStandalone(); // true when installed or in a native shell syncThemeColor(); // the browser or system bar follows the theme, in light and dark trackKeyboard(); // --pm-keyboard-inset: pinned bars rise above the on-screen keyboard onBack(() => close()); // Android back button or gesture, and Esc, for your own full-screen views haptic('success'); // a short vibration where the device has one

Page changes can move like an app. Wrap your router's navigation in viewTransition: a new page slides in, going back slides it away, tabs cross-fade. Without view transitions, or with reduced motion, the update simply runs.

import { viewTransition } from '@prismora/elements/app-transition'; viewTransition(() => router.push('/orders/1042'), 'push'); viewTransition(() => router.back(), 'pop'); viewTransition(() => router.push('/inbox'), 'tab');

Ship it as an app

RouteWhat you add
Installable web appA web app manifest with "display": "standalone" and icons, served over HTTPS. autoNative() then switches layouts once the app is installed.
Capacitor (App Store and Google Play)Build your site as static files and point Capacitor's webDir at them. isStandalone() is true inside the shell. Keep viewport-fit=cover.
Trusted Web Activity (Google Play)The installable web app plus a Digital Asset Links file; Bubblewrap generates the Android project.

Cost

Native mode adds no second set of components. The sheet helper (swipe and positioning) is about 1 KB gzip, shared by the overlays that use it. The app shell, the app bar and the helpers on this page are separate modules: a page that does not import them does not pay for them.