Fragiola

More

Server rendering

Every component renders on the server and hydrates without a mismatch, in React, Vue and Angular; what a server cannot know, and what to pass.

Every component renders on the server and hydrates in the browser with no hydration warning: react-dom/server and hydrateRoot in React, vue/server-renderer and createSSRApp in Vue, @angular/platform-server and provideClientHydration() in Angular. The conformance suite renders every scenario of the specs on a server in each framework, hydrates it, and checks that the page ends as the browser alone renders it, with the server's ids kept.

What a server cannot know

  • The reader's language. A calendar with no locale renders en-US on the server and in the browser's hydration of it, then takes the document's lang, else the browser's language, once it is mounted, and follows a later change of lang. Angular reads its document's lang on the server too. Pass locale to render the reader's language on the server. A Slider's format uses the runtime's default locale without locale: a server's may differ from the browser's, so pass locale with format.
  • The reader's date. "Today" is read when the calendar renders, on the server and in the browser: they agree unless the server's date differs from the reader's (another time zone, near midnight), which the hydration repairs. Pass a value or defaultValue when the first month matters.
  • Time zone names. A zoned date field writes its zone's name ("EST") from Intl, whose names come from each engine's ICU: Node and the browser disagree for some zones and locales (Europe/London in en-US: "GMT" on Node, "GMT+0" in Chromium), and the hydration then finds another text. Pass hideTimeZone to a zoned field rendered on a server in such a zone. A calendar system's names agree between Node and Chromium in the locales the suite checks.
  • Layout. Nothing is measured on a server. The overlays render closed, and the parts that follow a measurement render without it until they are mounted.
  • Portals. An overlay's portal content is never rendered on a server, even open or with the Portal's keepMounted: it appears once the page is hydrated.

Placed before hydration

  • Slider thumbs need nothing: their position is a percentage of their value, written in the server's page.
  • Collapsible and Accordion panels open from the start render with their size variables at auto and no enter transition, so the page shows them at once. A closed hiddenUntilFound panel renders hidden (React writes until-found once mounted; Vue and Angular write it on the server already).
  • The Tabs Indicator follows the selected tab's box, which only the browser can measure. With renderBeforeHydration (Base UI's name; Angular: *tabsIndicator="true"), the server writes a small inline script inside the Indicator. It measures the selected tab as the page parses, sets the Indicator's variables, and removes itself, so the hydration finds the Indicator as the browser renders it. Under a Content Security Policy, give the script its nonce (nonce; Angular: *tabsIndicator="true; nonce: cspNonce", or Angular's own CSP_NONCE provider), the one your policy allows (script-src 'nonce-…'); a page that blocks inline scripts with no nonce leaves renderBeforeHydration off.
<Tabs.List aria-label="Settings">
    <Tabs.Tab value="account">Account</Tabs.Tab>
    <Tabs.Tab value="password">Password</Tabs.Tab>
    <Tabs.Indicator renderBeforeHydration nonce={cspNonce} />
</Tabs.List>

Ids

The ids the parts generate are the same on the server and in the browser: React's and Vue's useId, and in Angular a counter of the application's own (one per render), so a hydrated page keeps the server's ids and every aria-labelledby and aria-controls with them.

Forms

React and Vue render the hidden inputs of the form controls (Checkbox, Switch, Radio, Select, Combobox, Slider, DatePicker, DateRangePicker) on the server too. Angular adds them in the browser once the page is hydrated, since its directives create them outside their templates: a form posted before the page is hydrated has no value of theirs.

Images

An Avatar's status is idle on the server: its Image renders nothing and its Fallback is rendered (none with a delay, which has not passed). The image loads once the page is mounted in the browser; a cached one is shown before the browser paints.