Components
App shell
Full-height web app frame; sets the responsive --gutter. Web: .ct-app, .ct-app-main, .ct-view.
The full-height frame of the web app. .ct-app on <body> stacks the site header, the app bar and .ct-app-main; each .ct-view fills the main area. It sets --gutter from the viewport for everything inside it, so panes, sheets and bars line up.
Live example
The real classes from /site/chitransit.css in frames at phone, tablet and desktop widths, in the docs theme. The contract below shows each width in light and dark.
Code
<body class="ct-app">
<header class="ct-site-header">…</header>
<div class="ct-app-bar">…</div>
<main class="ct-app-main">
<section class="ct-view ct-split" id="view-stations">…</section>
<section class="ct-view ct-map-shell" id="view-map" hidden>…</section>
</main>
</body>
Responsive behavior
| Viewport | Layout |
|---|---|
| > 900 wide | --gutter is spacing.gutter (20). |
| ≤ 900 wide or ≤ 500 tall | --gutter is spacing.gutterCompact (16), or the side safe area if larger. |
| ≤ 390 wide | --gutter is spacing.gutterNarrow (12), or the side safe area if larger. |
Tokens
From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.
| Custom property | Value | Alias | Resolves to |
|---|---|---|---|
--ct-app-shell-background | var(--paper) | {colors.paper} | #FFFFFF #0F141C |
--ct-app-shell-gutter-compact | var(--space-gutter-compact) | {spacing.gutterCompact} | 16 pt |
--ct-app-shell-gutter | var(--gutter) | {spacing.gutter} | 20 pt |
--ct-app-shell-gutter-narrow | var(--space-gutter-narrow) | {spacing.gutterNarrow} | 12 pt |
Variants
One form; no variants: .ct-app on <body>, one .ct-app-main and a .ct-view per view. --gutter follows the viewport. Nothing else exists.
<!-- Do -->
<body class="ct-app">
<header class="ct-site-header">…</header>
<div class="ct-app-bar">…</div>
<main class="ct-app-main">
<section class="ct-view ct-split" id="view-stations">…</section>
</main>
</body>
<!-- Don't: a gutter set per page -->
<body class="ct-app" style="--gutter:24px">…</body>
Usage
Do
- Use it for app-like pages whose views fill the screen; scroll inside panes, sheets and pages.
- Pad with
var(--gutter)inside it so everything follows the same responsive gutter.
Don't
- Don't use it for document pages that scroll as a whole; use a Page container.
- Don't set
--gutterper page; change the tokens.
Accessibility
- Use one
<main>(.ct-app-main), a<header>for the site header and a<nav>for the tabs. - Give each view a heading so screen-reader users can find their place after switching views.
Contract
Contract: components/app-shell.yaml. States are drawn live by transit.js.
Loading the contract…