App

Updated: Sep 24, 2026
Render exactly one App at the root of every toolkit application and wrap all application content with it. App registers the text font, scopes the stylesheet reset and base typography, establishes directional navigation and automatic initial focus, mounts the toast presenter, and creates the portal root for tooltips, menus, and other floating interface elements. Keeping these responsibilities in one root makes focus, platform-aware interaction feedback, and overlays consistent across the application.
App fills its parent, so the host page must provide a box with a real size. Prefer layouts based on the available viewport rather than a fixed viewport size so content remains responsive.

Usage

Render App around the routed application. It loads the packaged stylesheet.
import { createRoot } from 'react-dom/client';
import { App } from '@wearables-ui-toolkit/mrbd';
import { AppRoutes } from './AppRoutes';

function Root() {
  return (
    <App>
      <AppRoutes />
    </App>
  );
}

createRoot(document.getElementById('root')!).render(<Root />);
App loads the packaged component styles, semantic token custom properties, and typography classes automatically.
Give the host document a full-viewport box so App has space to fill, and use the window background role for the document:
html,
body,
#root {
  height: 100%;
  margin: 0;
  background-color: var(--uit-color-background-window);
}
App already paints this background on its root. Applying it to the document as well prevents areas outside App, such as space exposed by overscroll, from showing the browser’s default white.
Use className or style on the outer root for an application-wide inset or background. App preserves its sizing unless your values override those properties:
<App className="app-shell" style={{ padding: 'var(--uit-spacing-medium)' }}>
  <AppRoutes />
</App>
App is also available from its component subpath:
import { App } from '@wearables-ui-toolkit/mrbd/App';

Props

The complete prop type is AppProps.
PropTypeDefaultDescription
children
ReactNode
—
Required application content. All content rendered with the toolkit must be inside App.
className
string
—
Class applied to the outer root element.
style
CSSProperties
—
Inline styles merged over the root’s positioning and sizing styles. Values supplied by the application take precedence for the same property.
App accepts no other DOM props and does not forward a ref.

What App provides

  • Text font.App registers Noto Sans in the regular, medium, and bold weights used by the design system. It checks for an installed copy first by registering local-only font faces ahead of the downloadable family. On its first mount, App appends the Google Fonts stylesheet link and preconnect hints; the browser fetches font files only when no local copy is installed. No font package is needed, and the toolkit registers no other family.
  • Theme scope. The root anchors the stylesheet’s element reset and base typography. The box-sizing and margin and padding reset, text font stack, font smoothing, window background, and primary text colors apply within this subtree. The zero-specificity reset does not override component styles or affect the host document outside App.
  • Platform profile.App supplies the Meta Ray-Ban Display platform profile to its subtree. Components such as Container and Surface read this profile automatically when calculating their default content scale, so applications do not pass a platform value to individual components.
  • Focus root.App scopes the focus-navigation provider to its content and enables automatic initial focus. On mount, and when the focused element is removed, the toolkit focuses the top-left eligible interactable. The toolkit skips elements without a measured box and elements with initialFocusEligible={false}. If nothing else has focus on mount, App focuses its content element to give directional navigation a starting point.
  • Toast presenter.App owns the toast container. Use the toast API to show a toast; mounting another presenter is unsupported because it can produce duplicate or inconsistent announcements.
  • Floating portal root.App provides an absolutely positioned overlay layer inside the content element. The layer sits above ordinary content and ignores pointer events while tooltips, context menus, vertical menus, and other floating interface elements render through it. Replacing this provider is unsupported because the toolkit owns consistent overlay placement and focus scope.
  • Tooltip boundary.App uses the content element as the boundary for anchored tooltips, keeping them within the application viewport.

Behavior

Layout. The outer root is relatively positioned and fills its parent in both axes. A nested content element fills the root and contains application content, the toast presenter, and the portal layer. The application can add padding or a background through style; values supplied there take precedence over the root’s own styles for the same properties.
Font registration.App inserts the font faces and stylesheet link into the document head once and leaves them in place. Registration is keyed to the injected stylesheet, so remounting App, or rendering more than one, does not duplicate them. During server rendering, when no document exists, App skips registration.
Focus. The toolkit uses arrow keys for directional focus movement among interactables inside App and preserves native Tab traversal so keyboard and assistive-technology users are not trapped. App fixes the provider settings and exposes no tuning props. If an embedded host temporarily parks document focus on an unowned application ancestor, the toolkit restores the current interactable instead of clearing its visual focus state. Render a nested FocusNavigationProvider only when a subtree needs a different container or arrow-key-only traversal.
Rendering cost.App is memoized and re-renders only when children, className, or style changes. Prefer keeping application state below App so updates do not recreate the root.
Scope.App scopes each service it installs to its subtree. A nested App would create another focus root, toast presenter, and portal root, so this composition is unsupported.

Accessibility

  • The application owns the document title, landmarks, and accessible names; App does not add roles, landmarks, or accessible names.
  • The content element is programmatically focusable but is not a tab stop. This preserves the first real control as the target of the first Tab press.
  • Floating interface elements render through a layer inside the content element, so overlays stay in the same accessibility subtree as their related content.

Application responsibilities

  • Render one App at the top of the tree, above the router, so the toolkit has one consistent focus and overlay root.
  • Let App load the component styles, semantic tokens, and typography classes.
  • Give the mount element a real height so App can fill it responsively.
  • Let App own the platform profile, toasts, floating portals, and initial focus.

Avoid

  • Avoid recreating only part of the application shell; use App so fonts, focus, toasts, and portals remain coordinated.
  • Do not nest App. Multiple roots are an unsupported composition and create competing focus, toast, and portal ownership.
  • Do not mount another toast presenter or floating-portal provider. App owns both services for its subtree.
  • Avoid loading a different text font or overriding the registered family. Noto Sans is the public toolkit text font and keeps typography consistent.
  • Prefer a dark window background for the additive-light display. A light page background emits light where the design expects transparency.
  • Avoid fixed device dimensions. Size the root from the available viewport so the layout stays responsive across Meta Ray-Ban Display environments.