Browser support and SSR
Which browsers the styles assume, and which parts need a browser.
Browsers
The package declares no browserslist. The styles are written for evergreen browsers: current Chrome, Edge, Firefox and Safari. These are the CSS features the component styles rely on, found by searching the source:
- Custom properties everywhere (the whole token system).
- Flexbox and grid with
gap. - Logical properties (
inset,margin-inline-start,padding-blockand friends) for right-to-left layouts. color-mix(),:has(),dvhunits and one container query.aspect-ratio,clamp()andprefers-reduced-motion.
The JavaScript targets ES2020 and uses Intl.NumberFormat, Intl.DateTimeFormat (with ar-EG-u-nu-latn so digits stay Western), matchMedia, AbortController and the Clipboard API (copy buttons say "Couldn't copy" when it is blocked).
Older browsers are not tested. Treat anything that predates
:has()support (Safari before 15.4, Chrome before 105, Firefox before 121) as unsupported.
Server-side rendering
Parts of the library read window or document and need a browser; parts do not.
| Safe to render on the server | Needs a browser |
|---|---|
| Presentational components that take props: the kit's primitives, patterns, tables, charts, and the blocks and PR blocks | useViewportTier(initial?) and useIsMobile: in the browser the first render reads window.innerWidth (so a phone never flashes the sidebar); with no window the hook gives initial, else 'desktop', and the first effect then reads the real width |
BricksProvider, MoneyNotesProvider, DataProvider, and AppShell (pass its tier, 'desktop', 'tablet' or 'mobile'; without it the server draws the desktop frame) | Modal, Drawer and useModalLock / useFocusTrap in effects (they do nothing on the server, and render nothing while closed) |
formatMoney, moneyParts, count, shortDate, days | useReducedMotion returns false on the server and reads matchMedia after mount |
The URL helpers: readParams, writeParams, useHashState and the rest return empty values and do nothing without window | |
createHttpClient (it reads fetch when a request is made) |
useViewportTier no longer reads window while rendering on the server, so renderToString(<AppShell tier="mobile" …>) works (the library's own server test does exactly that). Two things to know:
- On the server
useViewportTier()anduseIsMobile()answer'desktop'(or theinitialyou pass touseViewportTier). In the browser they read the width on the first render, so a server render and a hydrating phone can disagree for one frame. Pass the same first value on both sides, or draw the width-dependent part after mount. AppShell'stieris the first value and it pins the layout: while the prop is set the shell stays in that tier whatever the window does. It is meant for the server render, tests and embedded previews. To follow the window after hydration, stop passingtieronce the page has mounted.
The docs examples are rendered once in jsdom as part of the build, which catches an example that throws, but jsdom is not a server render: it has a window.
Right to left
Layout uses logical properties, so setting dir="rtl" on a wrapper mirrors the component. See Languages and RTL.