The top bar of an application: brand, navigation links, then search, action buttons, the theme switch and the user, in five looks; the links fold into a menu when they do not fit.
Options
| Choice | Values | Default | What it does |
|---|---|---|---|
looksmbk-app-bar--look-<value> | floatingfloating-hugflatsplitcentred | floating | Floating: a raised bar with rounded corners and a hairline edge, the links in the true middle. Floating hug: the same bar only as wide as its content, centered. Flat: a square bar with no edge or shadow, a line along its foot. Split: the brand on an island of its own at the start, the links and the end group on one at the end. Centred: the links at the start, the brand in the middle. Figma calls this Style. |
sizesmbk-app-bar--size-<value> | mdlg | md | How large the links in the wide bar are. md is Figma's: the middle navigation item. lg is the large item, as the bar drew them before. The menu keeps its large items either way. |
backgroundsmbk-app-bar--background-<value> | onoff | on | The bar's own surface. Off drops its fill, edge and shadow so it sits on whatever is behind it; the open menu keeps its surface, as Figma draws the open bar only with one, and a bar that hides on scroll takes the page's own surface while it sticks. Figma: Background (on by default). |
linesmbk-app-bar--line-<value> | onoff | on | The hairline along the foot of a flat bar. Only the flat look draws it. Figma: Line (on by default). |
logosmbk-app-bar--logo-<value> | onoff | on | The brand at the start of the bar in a wide space. Off drops it, for a page whose logo sits elsewhere, such as at the top of a sidebar that runs the page's full height; the links then start the bar, and a badge stays. The narrow bar keeps its logo either way. |
linkssmbk-app-bar--links-<value> | betweenstartend | between | Where the links sit in a wide space. Between: in the middle of the bar, as Figma draws it. Start: right after the brand, the free room after them, as the Showroom App bar draws them. End: pushed to the end, just before the search, buttons and theme switch, for a bar laid over a page whose middle is its own, such as a home page with a large picture behind it. Start and end are not in the App bar component in Figma. The menu is the same either way. |
nav-typesmbk-app-bar--nav-type-<value> | linkstabs | links | How the wide bar draws its links. Links: navigation items. Tabs: small line tabs that fill the bar's whole height, the current page's underline on the bar's foot; the bar is then 64 tall. Either way they are links, the current one marked as the current page, and the menu lists them as navigation items. Figma: AppBarNav's Type. |
foldsmbk-app-bar--fold-<value> | noneactionslinks | none | What has folded away in a wide space too narrow for the whole row. Actions: the action buttons are gone. Links: the actions and the links are gone and the menu button shows, opening the links under the bar. The wrapper measures the row and sets it; markup written by hand sets it the same way. |
expandedsmbk-app-bar--expanded | On or off | Off | The menu is open under the bar: in a narrow space, or in a wide one whose links have folded away. |
hide-on-scrollsmbk-app-bar--hide-on-scroll | On or off | Off | In a narrow space, the bar stays at the top of the window while the page scrolls, slides up out of sight as the reader scrolls down and comes back as they scroll up. For a page that scrolls the window; turned on page by page. Has no effect in a wide space. Not in Figma. |
scrolled-awaysmbk-app-bar--scrolled-away | On or off | Off | The bar has slid up out of sight. The wrapper sets it while the reader scrolls down a page with hide on scroll on; plain markup sets it the same way. Has no effect without hide on scroll or in a wide space. |
zonesmbk-app-bar--zone | On or off | Off | The bar's own room, as Figma draws it: the medium inset above and below a floating bar and a step in from the sides, and its row held to the content width. Off by default, so a page that already leaves room around its bar keeps its own. |
sidebar-startsmbk-app-bar--sidebar-start | On or off | Off | In a wide space the start is as wide as the expanded sidebar, its logo the sidebar's logo size and in line with the sidebar's rows, so links that follow it (links start) begin where the page beside a sidebar begins. For a bar across the top of a page with a sidebar under it at the same side gutter as the bar's own inset. Not in the App bar component in Figma; drawn in the Showroom App bar. |
frostedsmbk-app-bar--frosted | On or off | Off | A blur behind the bar, strongest at the top and gone by its foot, so what scrolls under it is never read sharply there. For a bar with its background off, or with its own room. Not drawn when the system asks for forced colors. |
Examples
Usage
Brand, links in the middle, then action buttons, the theme switch and the user, in a wide space.
Links and search
A search field at the end; there the links keep the same room on either side, and the search field narrows first. The Showroom's own bar.
Without links
The links are optional too; the end group keeps its place at the end.
Without background
The bar without its own surface, edge or shadow, sitting on what is behind it.
Without logo
The logo off, for a page whose logo sits at the top of a full-height sidebar; the links start the bar. A narrow bar keeps its logo.
Links at the end
The links pushed against the end group, for a bar laid over a page whose middle is its own, such as a home page with a large picture behind it.
Guidelines
Purpose
The bar across the top of an application screen: the brand, the main links, and at the end a search field, a couple of action buttons, the theme switch and the signed-in user. It is for a product someone is working in. The header is its cousin for a marketing or documentation site; the two share their looks and their parts.
When to use
- The top of every screen of an application.
When not to use
- A website. Use the header, which has the same looks.
- Inside a page. It is page chrome, not content.
Usage rules
Do
- Give the user slot a way to sign out.
- Keep the links to the few that matter most; the same list fills the menu.
- Give every link an icon, or none.
- Turn on the bar's own room only where the page leaves none around it, so the space is never doubled.
Don't
- Put more than two or three action buttons in it. Move the rest behind a menu.
- Rely on the action buttons in a narrow space or a crowded wide one: they fold away, so anything they do must be reachable elsewhere too.
Keep two or three action buttons in the bar and move the rest behind a menu, so the bar stays calm.
A row of six icon buttons is hard to tell apart and crowds out the links.
Anatomy
- The block, a raised bar with a hairline edge. With the background off it has no fill, edge or shadow and sits on the page behind it; the open menu keeps its surface.
- Five looks: floating (the default), floating hug (only as wide as its content, centered), flat (square, no edge or shadow, a hairline along its foot that the line setting turns off), split (the start on an island of its own, the links and the end on another) and centred (the links at the start, the brand in the middle).
- The panel part: the bar's surface when the bar has its own room or a frost; otherwise it is no box and the block draws the surface.
- The bar part, the row: the start part (the brand part with the logo part, then an optional badge part), the trail part holding the nav part (navigation items with their icons and any count or dot, the same links drawn as line tabs, or other content in their place) and the end part (the search part, the actions part, the theme switch and the user; a search button, in a narrow space, or in a wide one with no search field; and in a narrow space or once the links have folded the menu button part).
- The logo part is the built-in simbolik logo, or a site's own picture files with their dark versions (
logoPicture, the logo'spicture): the whole logo in a wide space and the mark in a narrow one. Anything else goes in the brand's place (brand), or in the whole start's place (start), such as a back button and a title part. - The second row part, under the bar: a divider and the second row nav part, a row a control tall for further navigation such as line tabs.
- The menu part, under the bar when expanded: the links as large navigation items each filling its row, and in a narrow space the theme switch at the end.
- The frost parts, three layers behind the bar when frosted.
Behavior
One markup serves both forms. In a wide space the links sit in the true middle of the bar: the start and the end share what the links leave equally, and where there is too little room each end keeps what it holds and the links move off the middle rather than overlap. Set to the start, the links follow the start and the free room comes after them. Set to the end, the links sit against the end group. An end group holding a search field keeps the same room on either side of the links instead, and there the search field narrows first. In a narrow space the links, the search field and the action buttons are removed and replaced by a search button and a menu button, and the menu button stacks the links under the bar. The form follows the layout switch, so a wrapper can force either. The menu state can be controlled from outside or left to the bar. Escape closes the open menu and puts focus back on the menu button. The menu grows open under the bar with the enter motion and closes a little faster with the exit motion; under reduced motion it opens and closes at once.
In a wide space too narrow for the whole row, the bar folds parts away rather than cutting them off: first the action buttons, then the links, whose place the menu button takes; it opens them under the bar. The bar measures its own row whenever its size or content changes and once the fonts have loaded, and keeps the least folded form that fits, so the links come back as soon as there is room. Only links fold: content passed in their place stays. Before the page's script runs the row clips what it cannot hold, so the page never scrolls sideways. fold={false} keeps every part in the row; a stage ("actions", "links") holds the bar there. Markup written by hand sets the fold modifier itself.
The bar can have its own room (zone): the medium inset above and below a floating bar and a step in from the sides, a smaller one in a narrow space, and none around a flat bar; past the content width its row stays that wide and centered while the surface runs on. It is off by default, so a page that already leaves room around its bar keeps its own. A frosted bar has a blur behind it, strongest at the top and gone by its foot, so what scrolls under it is never read sharply there; it shows where the bar has no background of its own, or in its room, and is not drawn when the system asks for forced colors.
The links can be drawn as tabs (nav-type="tabs"): small line tabs that fill the wide bar's whole height, the current page's brand underline lying on the bar's foot, the bar then 64 tall. They are still links, the current page marked, and the menu lists them as navigation items as before. Over a page with a sidebar under the bar, the start can be as wide as the expanded sidebar (sidebar-start), its logo the sidebar's logo size and in line with the sidebar's rows, so links set to the start begin at the sidebar's edge. That lines up when the bar's side inset is the page's gutter, as a flat bar's across a page with the medium inset gutter is. Both change the wide bar only.
The logo can be turned off for the wide bar, for a page whose logo sits elsewhere, such as at the top of a sidebar that runs the page's full height: the links then start the bar, a badge stays, and the end group keeps its place. The narrow bar keeps its logo whatever the setting, because there the page's other logo is usually gone with its sidebar.
A page that scrolls the window can turn on hide on scroll, page by page. In a narrow space the bar then stays at the top of the window while the page scrolls under it, slides up out of sight as the reader scrolls down, and comes back as soon as they scroll up, so the menu and search are never more than a small scroll away. It ignores moves of a few pixels, stays while the page is still within the bar's own height of the top, never hides while one of its menus is open or keyboard focus is inside it, and comes back the moment keyboard focus moves into it. It slides away with the exit motion and back with the enter motion; under reduced motion it hides and shows at once. A flat bar sticks flush with the window's top, and a bar with its background off takes the page's own surface while it sticks, still with no edge or shadow, so nothing shows through it. While such a bar is on the page, the window keeps the bar's room clear at its top whenever it scrolls to bring something into view, a link reached with Tab or a heading jumped to, so nothing lands under the bar. A wide space keeps the bar as it is. A page that is one screen by design, such as a home page, leaves it off.
A page can take the menu over (onMenu): the menu button then calls the page instead of opening the bar's own menu, and the bar draws no menu, so the page opens its own, such as a drawer holding the links and more. The button then says it opens a dialog rather than that it is expanded. On a phone, for example, a drawer can hold the site's sections and its whole category tree, with the theme switch in the drawer's foot.
Hide on scroll needs the bar to stick to the top of the window, and a sticking element cannot leave the element around it. Place the bar straight in the page's column, or give a wrapper that holds only the bar display: contents in a narrow space.
Accessibility
What it does for you
- The bar is a banner landmark. The links in the bar are a navigation landmark named "Main" by default, and the menu links one named "Menu". Drawn as tabs they are the same links in the same navigation, never a tab list.
- A link's count and dot are part of its name, after a pause: "Issues, 18".
- The current page's link carries the current-page marker, and its label is a weight step bolder as well as filled.
- The menu button carries its expanded state and names the menu it controls; the search button is named "Search". Escape closes the open menu and returns focus to the menu button.
- Parts hidden by the layout switch or folded away are removed from the tab order, so nothing is reachable that cannot be seen.
- A badge after the brand is read after it.
- In the centred look the brand is still first in reading and Tab order, before the links that are drawn to its left.
- A bar that has scrolled out of sight comes back the moment keyboard focus moves into it, and stays while focus is inside it, so a keyboard user never works in a bar they cannot see.
What you must do
- Give the links another name when a page has more than one bar.
- Put something with an accessible name in the user slot, for example an avatar with the person's name.
- Give the words the bar says by itself, such as the menu button's and the search button's names, in the page's own language. They keep their English unless the page gives its own.
How to test
- Tab through the bar: focus moves in the order it is read, the focus ring shows in both themes and in a forced-color mode, and nothing hidden takes focus.
- Open the menu with Enter or Space, then press Escape: it closes and focus is back on the menu button.
- With a screen reader, the bar is read as a banner with a "Main" navigation, the current page is announced as current, and a link's count is read after its label.
- With text at 200% and the page 320 pixels wide, the bar folds to its menu and every link stays reachable.
- On a page that scrolls, scroll the bar out of sight, then Tab into it: it comes back.
Keyboard
| Key | What it does |
|---|---|
| Tab | Moves focus through the visible links and buttons in reading order. |
| Shift+Tab | Moves focus back through them. |
| Enter | Follows a link, or presses the menu button or the search button. |
| Space | Presses the menu button or the search button. |
| Escape | Closes the open menu and returns focus to the menu button. |
Source
The files the app bar is made of. Its folder on GitHub (opens in a new tab) holds them with its wrapper and its document.
Stylesheet
/* smbk-app-bar — App bar. Figma "App bar" 7353:700 (Style × Platform × State), built from AppBarStart,
* AppBarNav and AppBarEnd.
* The top bar of an application: the start (the brand and a badge), the links in the middle, then at the end
* the search field, action buttons, the theme switch and the user. In a narrow space the links, search and
* actions give way to a search button and a menu button, and the menu button opens a stacked list under the
* bar. Which form shows is the layout switch, never a width written here. In a wide space too narrow for the
* whole row the wrapper folds the actions away, then the links, and the menu button opens them (fold).
*
* What the app bar shares with the header, which is built from the same parts, is written once in
* ../bar/bar.css: the bar and its surface, the five looks, the zone, the frost, the second row, the row's common
* arrangement and the open menu's movement. This stylesheet keeps what is the app bar's own. */
.smbk-app-bar__second-row {
padding: 0 calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline)) calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline));
}
.smbk-app-bar--look-split .smbk-app-bar__second-row {
padding: calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline));
}
/* ==== The app bar's own row ==== */
/* Figma draws the bar's edge inside it (56 tall with a medium control between two medium insets), so each padding
here gives the edge's width back; the same in the narrow bar and its menu. The row clips what it cannot hold
until the page's script has measured it, so the page never scrolls sideways. */
.smbk-app-bar__bar {
display: flex;
justify-content: space-between;
gap: var(--smbk-space-inline-lg);
padding: calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline));
}
/* The links sit in the true middle, as Figma draws them: the start and the end share what the links leave
equally; where there is too little room each end keeps what its content needs and the links move off the middle
rather than overlap. An end group holding a search field keeps the bar's room on either side of the links
instead, because there the search field narrows first. Markup without a start part keeps the room on either
side too. */
.smbk-app-bar__start,
.smbk-app-bar__start ~ .smbk-app-bar__trail > .smbk-app-bar__end {
flex: 1 1 0;
}
.smbk-app-bar__bar:has(.smbk-app-bar__search) > .smbk-app-bar__start {
flex: 0 0 auto;
}
.smbk-app-bar__badge {
display: inline-flex;
align-items: center;
flex-shrink: 0;
}
/* A title in the bar, after a back button at the start or alone in the middle, as Figma's AppBarStart Back and
AppBarNav Title draw it: Label LG in the default text color, on one line. */
.smbk-app-bar__title {
overflow: hidden;
color: var(--smbk-color-text-default);
font-family: var(--smbk-typography-label-lg-font-family);
font-size: var(--smbk-typography-label-lg-font-size);
font-weight: var(--smbk-typography-label-lg-font-weight);
line-height: var(--smbk-typography-label-lg-line-height);
letter-spacing: var(--smbk-typography-label-lg-letter-spacing);
text-transform: var(--smbk-typography-label-lg-text-transform);
text-overflow: ellipsis;
white-space: nowrap;
}
/* The links (their row is in bar.css) never shrink. */
.smbk-app-bar__nav {
flex-shrink: 0;
}
/* Links at the end: the free room goes before them instead of on either side, so they sit
against the end group, the bar's own gap apart. */
.smbk-app-bar--links-end .smbk-app-bar__nav {
margin-inline-start: auto;
}
.smbk-app-bar--links-end .smbk-app-bar__end,
.smbk-app-bar--links-end .smbk-app-bar__start ~ .smbk-app-bar__trail > .smbk-app-bar__end {
flex: 0 1 auto;
}
/* Everything after the links, the small inline step apart. When space runs short, the search field is what gives;
what still does not fit runs on past the end, where the bar clips it and its script sees it to fold, never back
over the logo (safe). */
.smbk-app-bar__end {
justify-content: safe flex-end;
flex: 0 1 auto;
min-width: 0;
}
/* Beside the links in the true middle, the end group keeps all it holds; it narrows only once everything that can
fold has folded. */
.smbk-app-bar__start ~ .smbk-app-bar__trail > .smbk-app-bar__end {
min-width: auto;
}
.smbk-app-bar__bar:has(.smbk-app-bar__search) .smbk-app-bar__end,
.smbk-app-bar--fold-links .smbk-app-bar__end {
flex: 0 1 auto;
min-width: 0;
}
.smbk-app-bar__search {
flex: 0 1 auto;
width: var(--smbk-size-search-width);
min-width: 0;
/* Narrowed past its icon and hint, it keeps them inside its own sides rather than over its neighbours; its
shadow still shows below it. */
overflow-x: clip;
}
.smbk-app-bar__actions {
display: flex;
align-items: center;
gap: var(--smbk-space-inline-sm);
flex-shrink: 0;
}
.smbk-app-bar__end > :not(.smbk-app-bar__search) {
flex-shrink: 0;
}
.smbk-app-bar__divider {
height: var(--smbk-size-control-md);
}
/* The open menu, as Figma's open mobile app bar draws it: the links with their icons, each row a medium control
tall and the extra-small stack step apart, then the theme switch at the end; the medium inset at the sides and
above the menu's foot, no dividers. */
.smbk-app-bar__menu {
gap: var(--smbk-space-stack-xs);
padding: 0 calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline));
}
.smbk-app-bar__menu nav {
display: flex;
flex-direction: column;
gap: var(--smbk-space-stack-xs);
}
/* The theme switch at the menu's end shows only in the narrow form, where the bar has none of its own. */
.smbk-app-bar__menu-end {
display: none;
justify-content: flex-end;
}
/* ---- the looks' rows ---- */
/* Floating hug: none of the three places grows. */
.smbk-app-bar--look-floating-hug .smbk-app-bar__start,
.smbk-app-bar--look-floating-hug .smbk-app-bar__start ~ .smbk-app-bar__trail > .smbk-app-bar__end {
flex: 0 0 auto;
}
/* Split: each island has the bar's padding. */
.smbk-app-bar--look-split .smbk-app-bar__start,
.smbk-app-bar--look-split .smbk-app-bar__trail {
flex: 0 0 auto;
padding: calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline));
}
.smbk-app-bar--look-split .smbk-app-bar__start ~ .smbk-app-bar__trail > .smbk-app-bar__end {
flex: 0 1 auto;
}
/* Centred: the links at the start, the brand in the middle, the end at the end. */
.smbk-app-bar--look-centred .smbk-app-bar__nav {
order: 1;
flex: 1 1 0;
}
.smbk-app-bar--look-centred .smbk-app-bar__start {
order: 2;
flex: 0 0 auto;
}
.smbk-app-bar--look-centred .smbk-app-bar__end {
order: 3;
}
/* ---- fold: in a wide space too narrow for the whole row, the actions go first, then the links, and the menu
button takes their place, opening the links under the bar. The wrapper measures and sets it. The selectors
carry the block so they outweigh the narrow form's rules for the menu button. ---- */
.smbk-app-bar--fold-actions .smbk-app-bar__actions,
.smbk-app-bar--fold-links .smbk-app-bar__actions,
.smbk-app-bar--fold-links .smbk-app-bar__nav {
display: none;
}
/* ---- the two forms (the shared parts are in bar.css): the open menu's foot padding after a fold. ---- */
.smbk-app-bar--fold-links.smbk-app-bar--expanded .smbk-app-bar__menu {
padding-bottom: calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline));
}
/* Logo off: the wide bar starts with its links and keeps its end group at the end, even with no
links; a badge stays at the start. The narrow bar keeps its logo. */
.smbk-app-bar--logo-off .smbk-app-bar__brand,
.smbk-app-bar--logo-off .smbk-app-bar__start:not(:has(.smbk-app-bar__badge)) {
display: none;
}
.smbk-app-bar--logo-off .smbk-app-bar__start {
flex: 0 0 auto;
}
.smbk-app-bar--logo-off .smbk-app-bar__end {
margin-inline-start: auto;
}
@container style(--smbk-layout: narrow) {
.smbk-app-bar--logo-off .smbk-app-bar__brand {
display: inline-flex;
}
.smbk-app-bar--logo-off .smbk-app-bar__start:not(:has(.smbk-app-bar__badge)) {
display: flex;
}
}
/* ---- the wide bar's arrangements from the Showroom App bar (Figma 8061:17018). Each is wide only: the narrow bar
keeps its own form. ---- */
@container style(--smbk-layout: wide) {
/* Links start: the links right after the start and the free room after them, the start keeping only its own
width rather than sharing the room with the end. */
.smbk-app-bar--links-start .smbk-app-bar__start {
flex: 0 0 auto;
}
.smbk-app-bar--links-start .smbk-app-bar__nav {
margin-inline-end: auto;
}
/* Sidebar start: the start and the bar's gap after it as wide as the expanded sidebar, so the links begin at the
sidebar's edge; the logo a medium inset in, where the sidebar's rows begin, at the sidebar's own logo size. It
lines up when the bar's side inset is the page's gutter, as a flat bar's across a page with a medium inset
gutter is. */
.smbk-app-bar--sidebar-start .smbk-app-bar__start {
box-sizing: border-box;
flex: 0 0 auto;
width: calc(var(--smbk-size-sidebar-width) - var(--smbk-space-inline-lg));
padding-inline-start: var(--smbk-space-inset-md);
}
.smbk-app-bar--sidebar-start .smbk-app-bar__logo {
height: var(--smbk-size-icon-lg);
}
/* Nav type tabs: the links are small line tabs filling the bar's whole height, 64 with its edge, with no padding
above or below. The tabs reach over the bar's edge, so the current page's underline lies on the bar's foot line,
as Figma draws it; the bar's foot is their line, so the tabs draw none of their own. */
.smbk-app-bar--nav-type-tabs .smbk-app-bar__bar {
height: calc(var(--smbk-size-64) - 2 * var(--smbk-border-width-hairline));
padding-block: 0;
}
.smbk-app-bar--nav-type-tabs .smbk-app-bar__nav.smbk-tabs {
align-self: stretch;
align-items: stretch;
margin-block: calc(-1 * var(--smbk-border-width-hairline));
}
.smbk-app-bar--nav-type-tabs .smbk-app-bar__nav.smbk-tabs > .smbk-tabs__list {
height: auto;
box-shadow: none;
}
}
/* The narrow bar as Figma draws it: the medium inset all round, the row a medium control tall, the brand and the
end group at its two ends. */
@container style(--smbk-layout: narrow) {
.smbk-app-bar__bar {
padding: calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline));
}
.smbk-app-bar__menu-end {
display: flex;
}
.smbk-app-bar--expanded .smbk-app-bar__menu {
padding-bottom: calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline));
}
/* Floating hug: the places share the row. */
.smbk-app-bar--look-floating-hug .smbk-app-bar__start,
.smbk-app-bar--look-floating-hug .smbk-app-bar__start ~ .smbk-app-bar__trail > .smbk-app-bar__end {
flex: 1 1 0;
}
}
/* ---- hide on scroll: in a narrow space, a bar with the flag on stays at the top of the window, the
medium inset from its edge (the room a page leaves around its bar), over the page as it scrolls under it.
The wrapper marks it scrolled away while the reader scrolls down: it slides up past the window's edge,
by the gap above it and a large inset more so its shadow goes too, with the exit motion, and comes back
with the enter motion. It sticks inside the element around it, so that element must run the page's
length. At once under reduced motion. A wide space, where the page scrolls an inner area, keeps the
bar as it is. ---- */
@container style(--smbk-layout: narrow) {
.smbk-app-bar--hide-on-scroll {
position: sticky;
top: var(--smbk-space-inset-md);
z-index: var(--smbk-layer-sticky);
transition: translate var(--smbk-motion-enter-duration) var(--smbk-motion-enter-easing);
}
.smbk-app-bar--hide-on-scroll.smbk-app-bar--scrolled-away {
translate: 0 calc(-100% - var(--smbk-space-inset-md) - var(--smbk-space-inset-lg));
transition-duration: var(--smbk-motion-exit-duration);
transition-timing-function: var(--smbk-motion-exit-easing);
}
/* A flat bar runs edge to edge, so it sticks flush with the window's top, with no room above it. */
.smbk-app-bar--hide-on-scroll.smbk-app-bar--look-flat {
top: 0;
}
/* With its background off, a bar that sticks takes the page's own surface, still with no edge or shadow, so it
looks as it does at rest on the page while the page scrolls under it, and nothing shows through it. */
.smbk-app-bar--hide-on-scroll.smbk-app-bar--background-off:not(.smbk-app-bar--expanded) {
background: var(--smbk-color-surface-canvas);
}
}
@media (prefers-reduced-motion: reduce) {
.smbk-app-bar--hide-on-scroll {
transition: none;
}
}
/* While a page holds a bar that sticks, the window keeps the bar's room clear at its top whenever it
scrolls to bring something into view: a focused link, or a heading jumped to from a link to it. So
nothing lands under the bar. The room is the header height and the gap above the bar. In a wide
space, where the bar does not stick, the window keeps the same room, which only moves a jumped-to
heading a little further down. */
:root:has(.smbk-app-bar--hide-on-scroll) {
scroll-padding-block-start: calc(var(--smbk-size-header-height) + var(--smbk-space-inset-md));
}
/* The open menu starts from no height and no foot padding, so both grow (the movement is in bar.css). It comes
after the foot padding it replaces, which the starting style only overrides when it is the later rule. */
@starting-style {
.smbk-app-bar--expanded .smbk-app-bar__menu {
block-size: 0;
padding-bottom: 0;
}
}Tokens it reads
| Token and CSS | Value | Preview | Foundation |
|---|---|---|---|
| border-width.hairline--smbk-border-width-hairline | 1px | Border width | |
| color.border.rim--smbk-color-border-rim | light: #ffffffe6dark: #ffffff0dchanges with theme | Color | |
| radius.container.sm--smbk-radius-container-sm | 8px | Radius | |
| color.surface.default--smbk-color-surface-default | light: #f3f5f8dark: #181a1cchanges with theme | Color | |
| color.text.default--smbk-color-text-default | light: #232527dark: #e7ebf0changes with theme | Color | |
| elevation.raised--smbk-elevation-raised | light: 0px 2px 8px 1px #373d431a, 0px 1px 2px 0px #373d431adark: 0px 2px 8px 1px #00000026, 0px 1px 2px 0px #00000026 | Elevation | |
| motion.state.duration--smbk-motion-state-duration | 200ms | Motion | |
| motion.state.easing--smbk-motion-state-easing | cubic-bezier(0.65, 0, 0.35, 1) | Motion | |
| space.inset.md--smbk-space-inset-md | comfortable: 8pxcompact: 6pxchanges with density | Spacing | |
| space.inset.2xl--smbk-space-inset-2xl | comfortable: 24pxcompact: 16pxchanges with density | Spacing | |
| space.gutter.xs--smbk-space-gutter-xs | comfortable: 8pxcompact: 4pxchanges with density | Spacing | |
| space.0--smbk-space-0 | 0px | Spacing | |
| size.layout.container.default--smbk-size-layout-container-default | 1360px | Size | |
| blur.4--smbk-blur-4 | 4px | Blur | |
| blur.8--smbk-blur-8 | 8px | Blur | |
| blur.14--smbk-blur-14 | 14px | Blur | |
| color.border.subtle--smbk-color-border-subtle | light: #c4cdd8dark: #2d3237changes with theme | Color | |
| space.stack.sm--smbk-space-stack-sm | comfortable: 8pxcompact: 6pxchanges with density | Spacing | |
| space.inline.lg--smbk-space-inline-lg | comfortable: 12pxcompact: 8pxchanges with density | Spacing | |
| space.stack.md--smbk-space-stack-md | comfortable: 12pxcompact: 8pxchanges with density | Spacing | |
| space.inline.md--smbk-space-inline-md | comfortable: 8pxcompact: 6pxchanges with density | Spacing | |
| size.control.md--smbk-size-control-md | comfortable: 40pxcompact: 32pxchanges with density | Size | |
| focus.ring.width--smbk-focus-ring-width | 2px | Focus | |
| color.border.focus--smbk-color-border-focus | light: #cc0d0ddark: #f34336changes with theme | Color | |
| focus.ring.offset--smbk-focus-ring-offset | 2px | Focus | |
| radius.control.xs--smbk-radius-control-xs | 2px | Radius | |
| size.icon.xl--smbk-size-icon-xl | 32px | Size | |
| space.inline.xs--smbk-space-inline-xs | 4px | Spacing | |
| space.inline.sm--smbk-space-inline-sm | comfortable: 6pxcompact: 4pxchanges with density | Spacing | |
| motion.enter.duration--smbk-motion-enter-duration | 320ms | Motion | |
| motion.enter.easing--smbk-motion-enter-easing | cubic-bezier(0.16, 1, 0.3, 1) | Motion | |
| space.inline.2xl--smbk-space-inline-2xl | comfortable: 24pxcompact: 16pxchanges with density | Spacing | |
| motion.exit.duration--smbk-motion-exit-duration | 200ms | Motion | |
| motion.exit.easing--smbk-motion-exit-easing | cubic-bezier(0.7, 0, 0.84, 0) | Motion | |
| size.target.comfortable--smbk-size-target-comfortable | 44px | Size | |
| typography.label-lg--smbk-typography-label-lg-font-family--smbk-typography-label-lg-font-size--smbk-typography-label-lg-font-weight--smbk-typography-label-lg-line-height--smbk-typography-label-lg-letter-spacing--smbk-typography-label-lg-text-transform | fontFamily: Geist, Geist Fallback, system-ui, sans-seriffontSize: 16pxfontWeight: 500lineHeight: 1.4letterSpacing: 0px | The quick brown fox | Typography |
| size.search.width--smbk-size-search-width | 320px | Size | |
| space.stack.xs--smbk-space-stack-xs | 4px | Spacing | |
| size.sidebar.width--smbk-size-sidebar-width | 280px | Size | |
| size.icon.lg--smbk-size-icon-lg | 24px | Size | |
| size.64--smbk-size-64 | 64px | Size | |
| layer.sticky--smbk-layer-sticky | 1100 | Stacking order | |
| space.inset.lg--smbk-space-inset-lg | comfortable: 12pxcompact: 8pxchanges with density | Spacing | |
| color.surface.canvas--smbk-color-surface-canvas | light: #e7ebf0dark: #111213changes with theme | Color | |
| size.header.height--smbk-size-header-height | phone: 56pxdesktop: 80pxchanges with layout | Size |
Manifest
{
"name": "app-bar",
"block": "smbk-app-bar",
"summary": "The top bar of an application: brand, navigation links, then search, action buttons, the theme switch and the user, in five looks; the links fold into a menu when they do not fit.",
"adapt": "css",
"axes": {
"look": {
"values": [
"floating",
"floating-hug",
"flat",
"split",
"centred"
],
"default": "floating",
"description": "Floating: a raised bar with rounded corners and a hairline edge, the links in the true middle. Floating hug: the same bar only as wide as its content, centered. Flat: a square bar with no edge or shadow, a line along its foot. Split: the brand on an island of its own at the start, the links and the end group on one at the end. Centred: the links at the start, the brand in the middle. Figma calls this Style."
},
"size": {
"values": [
"md",
"lg"
],
"default": "md",
"description": "How large the links in the wide bar are. md is Figma's: the middle navigation item. lg is the large item, as the bar drew them before. The menu keeps its large items either way."
},
"background": {
"values": [
"on",
"off"
],
"default": "on",
"description": "The bar's own surface. Off drops its fill, edge and shadow so it sits on whatever is behind it; the open menu keeps its surface, as Figma draws the open bar only with one, and a bar that hides on scroll takes the page's own surface while it sticks. Figma: Background (on by default)."
},
"line": {
"values": [
"on",
"off"
],
"default": "on",
"description": "The hairline along the foot of a flat bar. Only the flat look draws it. Figma: Line (on by default)."
},
"logo": {
"values": [
"on",
"off"
],
"default": "on",
"description": "The brand at the start of the bar in a wide space. Off drops it, for a page whose logo sits elsewhere, such as at the top of a sidebar that runs the page's full height; the links then start the bar, and a badge stays. The narrow bar keeps its logo either way."
},
"links": {
"values": [
"between",
"start",
"end"
],
"default": "between",
"description": "Where the links sit in a wide space. Between: in the middle of the bar, as Figma draws it. Start: right after the brand, the free room after them, as the Showroom App bar draws them. End: pushed to the end, just before the search, buttons and theme switch, for a bar laid over a page whose middle is its own, such as a home page with a large picture behind it. Start and end are not in the App bar component in Figma. The menu is the same either way."
},
"nav-type": {
"values": [
"links",
"tabs"
],
"default": "links",
"description": "How the wide bar draws its links. Links: navigation items. Tabs: small line tabs that fill the bar's whole height, the current page's underline on the bar's foot; the bar is then 64 tall. Either way they are links, the current one marked as the current page, and the menu lists them as navigation items. Figma: AppBarNav's Type."
},
"fold": {
"values": [
"none",
"actions",
"links"
],
"default": "none",
"description": "What has folded away in a wide space too narrow for the whole row. Actions: the action buttons are gone. Links: the actions and the links are gone and the menu button shows, opening the links under the bar. The wrapper measures the row and sets it; markup written by hand sets it the same way."
}
},
"flags": {
"expanded": {
"description": "The menu is open under the bar: in a narrow space, or in a wide one whose links have folded away."
},
"hide-on-scroll": {
"description": "In a narrow space, the bar stays at the top of the window while the page scrolls, slides up out of sight as the reader scrolls down and comes back as they scroll up. For a page that scrolls the window; turned on page by page. Has no effect in a wide space. Not in Figma."
},
"scrolled-away": {
"description": "The bar has slid up out of sight. The wrapper sets it while the reader scrolls down a page with hide on scroll on; plain markup sets it the same way. Has no effect without hide on scroll or in a wide space."
},
"zone": {
"description": "The bar's own room, as Figma draws it: the medium inset above and below a floating bar and a step in from the sides, and its row held to the content width. Off by default, so a page that already leaves room around its bar keeps its own."
},
"sidebar-start": {
"description": "In a wide space the start is as wide as the expanded sidebar, its logo the sidebar's logo size and in line with the sidebar's rows, so links that follow it (links start) begin where the page beside a sidebar begins. For a bar across the top of a page with a sidebar under it at the same side gutter as the bar's own inset. Not in the App bar component in Figma; drawn in the Showroom App bar."
},
"frosted": {
"description": "A blur behind the bar, strongest at the top and gone by its foot, so what scrolls under it is never read sharply there. For a bar with its background off, or with its own room. Not drawn when the system asks for forced colors."
}
},
"parts": [
"panel",
"frost",
"bar",
"start",
"brand",
"logo",
"badge",
"title",
"trail",
"nav",
"end",
"search",
"actions",
"divider",
"menu-button",
"second-row",
"second-row-nav",
"menu",
"menu-end",
"wide-only",
"narrow-only"
],
"figmaNodeId": "7353:700"
}