Body
Body is a singleton Component that wraps the page's <body> element. It bootstraps the framework on first access and listens for viewport resize events to re-run layout from the root.
You don't usually instantiate components directly into Body; instead you attach top-level layout containers to it.
Usage
typescript
import { Body, Window, ThemeManager, DefaultTheme } from '@jimka/typescript-ui/core';
ThemeManager.setTheme(DefaultTheme);
const body = Body.getInstance();
const win = Window();
win.setHeaderText('Hello');
body.addComponent(win);
win.show();Notes
- Singleton — created automatically on first
Body.getInstance(). Do notBody()yourself. - Resize listener —
Bodylistens forwindow.resizeand re-runs layout from itself. Adding a top-level component toBodyis what wires it into the responsive layout pass. - Theme bootstrap — call
ThemeManager.setTheme(DefaultTheme)(or any theme) before adding components, so style rules pick up the right CSS variables.
See also
- API: Body
- Mental model — explains how
Bodyfits into the component tree. - Theming — what
setThemedoes at startup.