Aster UI / Guides
Choose an app shell
An application built with Aster UI usually runs in two places: in a browser tab, and as an installed app (a Tauri window or an installed web app). The shell is the outermost layout that holds the app's header and its workspace. Aster supports two shells, and an app can use both.
- Plain. The app fills the viewport, edge to edge. This is the default.
- Window. In a desktop browser tab with room to spare, the same app sits in a frame on the page: inset from the edges, with rounded corners, a border and a shadow. It looks like the installed app, in a tab.
Both shells hold the same screens, data, actions and view choices. The shell changes presentation only, so never put a feature in one and not the other.
Open the example: one device screen with tiles and a list. Its Shell choice switches between Automatic, Plain and Window so you can compare them on one screen.
When to use each
Use plain when:
- the app is installed, or runs in Tauri: the operating system already draws the window;
- the screen is a phone or tablet, or the browser window is small;
- the screen is dense, such as a wide grid, and needs every pixel.
Use the window shell, in addition to plain, when the app also ships installed and you want its browser tab to look like the installed app, or when the page backdrop, such as the Lamplight theme's, is part of the presentation.
If you are unsure, use plain. When you describe the choice to a person, show both on the same screen, with the same data, and let them pick.
What both shells share
- The document never scrolls. The header and the workspace heading stay in place, and the content area below them scrolls.
- A Grid in the content area fills it and scrolls its own rows.
- Add
aster-appto thehtmlelement; see application documents.
html, body { height: 100%; }
body {
box-sizing: border-box;
margin: 0;
padding: var(--app-frame-block, 0) var(--app-frame-inline, 0);
background: var(--aster-page);
}
.app-shell {
display: grid;
grid-template-rows: auto minmax(0, 1fr); /* header, workspace */
box-sizing: border-box;
height: 100%;
overflow: hidden;
border: var(--app-frame-border, 0);
border-radius: var(--app-frame-radius, 0);
background: var(--aster-surface);
box-shadow: var(--app-frame-shadow, none);
}
.workspace { display: flex; flex-direction: column; min-height: 0; }
.content { flex: 1; min-height: 0; overflow: auto; }
/* A grid fills the content area and scrolls its own rows. */
.content:has(> aster-grid) { display: flex; flex-direction: column; overflow: hidden; }
.content > aster-grid { flex: 1; min-height: 0; }
The frame spacing is padding on body, not a margin on the shell, so it
cannot collapse into the page and make the document scroll.
Add the window shell
The window shell is the plain shell plus a few variables, set by one media query. Without them, every frame value falls back to edge to edge.
@media (display-mode: browser) and (pointer: fine) and (min-width: 900px) and (min-height: 540px) {
:root {
--app-frame-inline: clamp(16px, 2.2vw, 28px);
--app-frame-block: 18px;
--app-frame-border: 1px solid var(--aster-rule);
--app-frame-radius: var(--aster-r-dialog);
--app-frame-shadow: var(--aster-e2);
}
}
Each condition does a job:
display-mode: browserkeeps an installed app plain, because its window is already a frame.pointer: finekeeps touch screens plain. A tablet in a browser is often wider than 900px, and a touch screen needs the space.- The minimum width and height keep small windows plain. Choose them for your layout: the frame costs about 56px of width and 36px of height.
Use theme tokens for the frame, as above, so it follows the theme and the light or dark scheme.
The pattern and the example's choices
These are the pattern: one document for both shells; a frame drawn only by CSS, under a media query on display mode, pointer and size; a fixed header and heading over a scrolling content area; and the same content in both.
These are the example's own choices, to adjust for your app: the 900 × 540
thresholds, the inset sizes, the tokens chosen for the frame, and the
Shell choice with its ?shell= parameter. An application chooses its
shell with the media query, not with a setting.
Overlays in the window shell
Dialogs, menus, pickers and toasts are placed against the viewport, not the frame. A modal dialog dims the whole page, including the space around the frame. Toasts appear near the bottom of the viewport, which puts them over the frame's lower edge. Menus and pickers open against their anchors, so they stay beside the control that opened them.
Don't set --aster-host-inset-* to the frame spacing to pull overlays
inside the frame. A host inset replaces the measured edge, including the
on-screen keyboard's height.
What Aster does not provide
Aster has no shell element or class, so the shell CSS above belongs to your application. Copy it from the example and adjust the values.
Where to go next
Run in Tauri and installed web apps covers title bars, screen edges and the on-screen keyboard in an installed shell.