Layout and feedback components
Layout and feedback components give an application a stable page frame and a clear way to show application state. Shells arrange desktop and mobile content. Status, loading, error, toast, alert, and progress components help users understand where they are and what is happening. The component library page explains the wider public composition model. See input controls, overlays and navigation, and editor and list molecules for related component groups.
Application shells
Application shells define the main regions around routed page content. DesktopShell combines optional rail and sidebar regions with a content area. MobileShell provides a full-screen content area with optional bottom navigation. Both shells give pages a shared place for headers and a clear scroll boundary.
The shell choice is a viewport-level decision. Use the desktop shell when navigation stays beside the page. Use the mobile shell when navigation belongs below the page and the platform should own touch scrolling. Desktop pages can either use one shell scroll region or turn shell scrolling off so inner panes own their overflow.
This diagram shows how page content enters a viewport-specific shell and how each shell assigns its navigation and scroll regions.
flowchart LR
Page[Page content] --> Desktop[DesktopShell]
Page --> Mobile[MobileShell]
Desktop --> Rail[Optional rail]
Desktop --> Sidebar[Optional sidebar]
Desktop --> Header[Page header target]
Desktop --> Scroll[Desktop scroll region]
Desktop --> Panes[Inner panes when shell scroll is off]
Mobile --> Header
Mobile --> ScrollMobile[Native mobile scroll region]
Mobile --> Nav[Optional mobile navigation]
References: src/…/DesktopShell.vue• L1-33 src/…/DesktopShell.api.md• L7-32 src/…/MobileShell.vue• L1-26 src/…/DesktopShell.md• L12-22
Desktop shell
DesktopShell establishes a horizontal app frame with optional rail and sidebar regions. Its content area places the page header above the page body. By default the body scrolls as one region. Set scroll to false for split views and board-like screens where inner panes own their overflow.
The shell registers its active scroll region for shell-level behavior such as returning to the top when the current navigation item is selected. Pages therefore do not need to pass scroll elements through several layout layers. When shell scrolling is off, there is no shell scroll element, so pages must use the scroll region owned by the relevant pane.
References: src/…/DesktopShell.vue• L6-31 src/…/types.ts• L1-15 src/…/DesktopShell.cy.ts• L37-85 src/…/DesktopShell.md• L17-57
Mobile shell
MobileShell fills the viewport and places page content in a native vertical scroll region. The nav slot sits below that region, so MobileNav stays available while the page moves. The shell also reserves safe-area space when the application runs as an installed mobile app.
References: src/…/MobileShell.vue• L1-49 src/…/MobileNav.vue• L1-19
Navigation regions
Navigation regions provide the durable choices that surround page content. Rail is the narrow icon column. Sidebar is the wider navigation panel. MobileNav is the equal-width bottom bar for small screens. Their children remain composable, so an application can place its own list, header, footer, or scroll region where the product needs it.
Rail
Rail supplies a narrow vertical frame and shared tooltip behavior for RailItem children. A rail item can navigate or emit a click. It can show an active state and an unread count as a pill or dot. The rail does not own scrolling, so applications decide how a long middle list should behave.
References: src/…/Rail.vue• L1-20 src/…/RailItem.vue• L1-190 src/…/types.ts• L4-43
Sidebar
Sidebar supplies a collapsible navigation frame. It can follow the small-screen breakpoint or accept a controlled collapsed state. SidebarItem, SidebarLabel, and SidebarSection provide common navigation pieces. SidebarHeader identifies the current workspace. SidebarCard supports a footer prompt such as an upgrade or onboarding notice.
The sidebar owns width and collapse state. It does not impose a body layout or scroll behavior. This separation lets each application choose how to combine its header, navigation list, and footer.
References: src/…/Sidebar.vue• L1-55 src/…/SidebarItem.vue• L1-200 src/…/SidebarSection.vue• L1-170 src/…/Sidebar.md• L3-77
Mobile navigation
MobileNav creates a bottom navigation frame whose MobileNavItem children share the available width. An item becomes a route link when it points to another destination. When it already represents the current route, selecting it returns shell content to the top instead of starting a second navigation.
References: src/…/MobileNav.vue• L1-19 src/…/MobileNavItem.vue• L1-129
Page headers
Page headers let a page declare its title and controls while the active shell decides where the header appears. PageHeaderTarget marks the shell location. PageHeader provides the usual desktop strip. PageHeaderMobile provides a fixed-height mobile strip that keeps its title centered between leading and trailing controls. PageHeaderBase is the shared primitive for custom header rows.
The header declaration stays with the page but renders in the shell. A header can combine navigation context such as Breadcrumbs with actions such as sharing or creating an item. A click on unused header space scrolls the page to the top. Controls and elements marked with data-no-scroll-top do not trigger that behavior. The mobile title stays on one line and remains centered when the leading and trailing controls have different widths. Those controls follow the page reading direction. The mobile back button follows in-app history and uses its to value only as a fallback for a cold deep link.
References: src/…/PageHeaderBase.vue• L1-55 src/…/PageHeader.vue• L1-18 src/…/PageHeaderMobile.vue• L1-87 src/…/PageHeaderTarget.vue• L1-21 src/…/PageHeaderBackButton.vue• L1-26 src/…/PageHeader.cy.ts• L133-193 src/…/PageHeader.vue• L1-32
Scroll regions
ScrollArea is the reusable scroll primitive for surfaces that need consistent scrollbar behavior. It provides a viewport with optional vertical, horizontal, or dual-axis scrolling. The exposed viewport is the real scrolling element, so other systems can observe or control the correct region without adding a nested scroller.
Desktop shells use ScrollArea for the normal page body. Mobile shells use native scrolling for touch momentum and overscroll behavior. Settings and other bounded panels can use ScrollArea without using a full shell.
References: src/…/ScrollArea.vue• L1-49 src/…/types.ts• L1-18 src/…/ScrollArea.md• L3-31
Layout separators
Divider
Divider separates adjacent content with a horizontal or vertical rule. It can also place a compact button on the rule, which turns a visual boundary into an entry point for an action such as loading more content or editing a split view.
Use a horizontal divider between stacked content and a vertical divider between side-by-side content. The action position can be at the start, center, or end. A flex item divider can stretch across the height supplied by its parent.
References: src/…/Divider.vue• L1-17 src/…/types.ts• L6-27 src/…/Divider.md• L1-18 src/…/Divider.api.md• L7-33
Loading feedback
Loading components distinguish an unknown wait from content with a known shape or measurable completion. Spinner shows ongoing indeterminate work. LoadingText pairs it with a short message. Skeleton reserves the shape of content until the real content is ready.
Choose the smallest signal that keeps the user oriented:
| State | Component | User meaning |
|---|---|---|
| Ongoing work with no known end | Spinner | The operation is active. |
| Ongoing work that needs a short explanation | LoadingText | The operation is active and named. |
| A page or card is taking shape | Skeleton | Content will appear in this location. |
References: src/…/Spinner.vue• L1-56 src/…/LoadingText.vue• L1-12 src/…/Skeleton.vue• L1-6
Error feedback
ErrorMessage presents an inline error as an assertive message. It accepts a string, an array of strings, or an Error object. An error can carry several messages, and the component shows each useful line while falling back to the error's main message when needed. A server-side validation example shows how a failed save can present several messages beside the action that needs correction.
The component keeps safe markup and removes executable content before display. It suits a local failure near the field, action, or content that needs correction.
Use input and selection controls for field-level input state. Use overlays and navigation when the error belongs to a dialog or another temporary surface. Keep the error close to the operation that caused it so the user can act on it.
References: src/…/ErrorMessage.vue• L1-50 src/…/types.ts• L1-9 src/…/ErrorMessage.md• L9-21 src/…/ErrorMessage.test.ts• L21-101 src/…/ServerError.vue• L1-27
Status indicators
Status badges
Badge is a compact label for a state, category, count, or other short value. Its theme gives the value a shared color meaning. Its variant and size let the same status fit into dense rows, cards, or more prominent summaries without changing the content.
Use a badge when the state belongs to an object or list item. Use an alert or error message when the state needs an explanation or a user action.
References: src/…/Badge.api.md• L7-52 src/…/types.ts• L1-13
Status alerts
Alert is an inline status message that can offer a next step. Its layout follows its content. A title-only message is a compact row. A description or a second action creates a banner. The theme changes the status treatment.
The component does not own visibility. Dismissal emits an event. The parent decides whether to remove or hide the alert. Actions can wait for asynchronous work and expose the same dismissal path. This keeps a recovery action and the alert lifecycle connected. While an action runs, its button shows loading and ignores repeat clicks. A caller-provided loading state takes priority.
Alert urgency also controls how assistive technology announces the message. Red and amber themes use an assertive alert role. Other themes use a status role so they do not interrupt the user as strongly.
Alert actions use Button as their action surface. The alert gives row actions a compact ghost treatment. Banner actions use a stronger primary treatment and a neutral secondary treatment unless the caller supplies its own variant or theme. Button also treats a loading action as disabled, so feedback and interaction state stay aligned.
The icon can use the alert theme's default glyph, be hidden, or be replaced with a custom glyph. Rich title and description slots keep the message content-driven while the parent still owns dismissal. The interactive examples cover themes, icon choices, actions, and dismissal.
References: src/…/Alert.vue• L22-45 src/…/Alert.vue• L78-166 src/…/Alert.api.md• L7-83 src/…/Alert.md• L1-75 src/…/types.ts• L5-80 src/…/Alert.playground.vue• L1-90 src/…/Button.vue• L44-52 src/…/Button.vue• L209-241
Toast notifications
Toasts are short-lived, non-blocking notifications for events that do not need to stop the current task. The application mounts ToastProvider once through the root provider. Callers then use the exported toast helper to publish message, success, info, warning, error, loading, promise-based, or custom notifications. The helper follows the current vue-sonner API. Older create, remove, and removeAll calls are not part of its public contract.
An asynchronous operation can keep one toast and change it from loading to success or error. A promise can manage the same lifecycle directly. Plain-string messages and descriptions are sanitized before display. Component content can pass through as a rendered value. Toasts may include an action. The provider keeps their position, visual treatment, and visible stack consistent across the application.
The provider places toasts at the bottom right for left-to-right pages and at the bottom left for right-to-left pages. It shows up to three at once and gives each toast a close button. A toast normally closes after four seconds. An infinite duration keeps it open until the user or application closes it.
This sequence shows how one asynchronous action keeps its feedback in one notification instead of creating a new notification for each state.
sequenceDiagram
participant App as Application action
participant T as toast helper
participant P as ToastProvider
participant U as User
App->>T: Publish loading state
T->>P: Show one notification
App->>T: Update same notification
T->>P: Show success or error
P-->>U: Offer result and optional action
Use a toast for a brief global result. Use an alert or error message when the state must remain beside the affected content. ToastOptions describes shared call options. ToastId lets a caller update or dismiss one notification in place.
References: src/…/toast.ts• L1-87 src/…/ToastProvider.vue• L1-59 src/…/Toast.md• L3-135 src/…/types.ts• L9-27 src/…/Toast.test.ts• L40-109 src/…/FrappeUIProvider.vue• L1-120
Progress feedback
Progress communicates measurable completion from zero to one hundred percent. It can show a label and hint. It can animate a continuous fill or divide the track into intervals for a multi-step flow. Values outside the valid percentage range are kept within that range before display. The interactive example exposes size, label, hint, and interval choices for these two forms.
The same primitive covers uploads, storage use, onboarding completion, and step-based forms. Use progress when the user can understand how far work has moved. Use loading feedback when the end point or amount of work is not known.
References: src/…/Progress.vue• L1-113 src/…/types.ts• L1-16 src/…/Progress.api.md• L7-49 src/…/Progress.cy.ts• L20-43 src/…/Progress.md• L10-37 src/…/Progress.playground.vue• L1-48
Change checklist
When these files or sections are changed, remember to consider these:
- When changing shell scroll behavior, check both the desktop
ScrollAreaviewport and the mobile shell's native viewport. Navigation items and header actions depend on the shared scroll target. - When changing page-header mounting or teleport behavior, check both shell targets and pages that declare headers. A missing target changes the header from an in-shell element to a body-level element.
- When changing mobile header sizing or title alignment, check long titles and both reading directions. Leading and trailing controls must not change the fixed header height or move the title off center.
- When changing sidebar or rail overflow, check unread badges and tooltips. Some rail content stays outside an overflow boundary so it remains visible.
- When changing toast mounting, check the root provider and calls made during page setup. Toasts published before the provider subscribes are not shown.
- When changing the toast API or message rendering, check all creator paths. The public helper must keep its current
vue-sonnersurface and sanitize plain-string messages and descriptions across semantic, message, loading, promise, and custom calls. - When changing toast position, visible count, duration, close behavior, or collapsed-stack rendering, check both left-to-right and right-to-left pages. These provider rules affect every notification and its action layout.
- When changing alert layout rules or action defaults, check both title-only rows and banners. A description or second action changes the layout and the action treatment.
- When changing alert roles or theme mapping, check both visual status colors and assistive-technology urgency. Red and amber alerts are interruptive while other themes are polite status messages.
- When changing alert or button loading behavior, keep the loading state, native disabled state, and repeat-click guard aligned. Async alert actions must not start twice.
- When changing a feedback component's semantic role, keep its visual state and assistive-technology announcement aligned. Alerts and statuses do not have the same urgency.
- When changing progress value rules, preserve the difference between a measured completion bar and an indeterminate loading signal. Keep out-of-range values from reaching the progress bar as invalid values.
- When changing
ErrorMessageinput handling, keep string arrays andError.messagesaligned with the shared error-line contract used by input labeling. Preserve safe rendering for every message shape. - When changing divider actions or shared action defaults, check both horizontal and vertical dividers. The action changes the rule from a plain separator into an interactive boundary.
- When changing badge themes or variants, check the meaning of status colors across badges, alerts, and other status icons. A visual change can alter the meaning users assign to a state.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A desktop shell is set to non-scrolling while a child pane has no overflow owner | Page content can be clipped without a usable scroll path | Give each intended inner pane its own overflow region. |
| A page header is declared without an active shell target | The header can render at the document body instead of in the app frame | Mount the matching shell and its PageHeaderTarget before the page. |
| A mobile header allows title text to wrap or control widths to shift its center | The page content can move as routes change and the title can look off center | Keep the mobile header fixed in height and reserve equal space for the widest leading or trailing control. |
A Sidebar body assumes built-in scrolling | Long navigation content can overflow the fixed-height sidebar | Add an application-owned scroll region around the list. |
ToastProvider mounts after setup code publishes a toast | Early feedback is lost | Mount the provider at the application root before pages run. |
| A toast creator bypasses the wrapper's safe rendering path | Plain-string content can lose the shared sanitization contract | Route message and description strings through the exported helper. |
| A toast provider rule changes without checking RTL or the collapsed stack | Notifications can appear on the wrong side or expose clipped content | Keep direction-aware placement and the provider's stack rendering rules together. |
| An alert action starts again before its async work ends | The same recovery or side effect can run more than once | Let the alert action stay loading until its promise settles. |
| An alert theme uses the wrong semantic role | Assistive technology can miss an urgent state or interrupt for a mild one | Keep red and amber as alerts and other themes as statuses. |
| A known completion value is shown with an indeterminate spinner | The user cannot tell how much work remains | Use Progress for measurable work. |
| A progress value outside the percentage range is passed as an invalid bar value | The progress control can reject the value or show the wrong state | Clamp the value before it reaches the progress control. |
| An inline error is rendered without its local operation context | The user sees a failure but not where to fix it | Place ErrorMessage beside the affected control or content. |
| An error message is inserted without the shared safe rendering path | User-controlled markup can execute or distort the message | Pass the value through ErrorMessage and its sanitizing boundary. |
| A vertical divider is used between uneven flex items without flex-item sizing | The separator does not span the intended content height | Use the flex-item mode when the parent supplies the cross-axis size. |
| A badge color is changed without checking related status components | The same color can suggest different states in nearby UI | Keep badge, alert, and status-icon theme meanings aligned. |
Key files
| File | Why to read it |
|---|---|
| src/index.ts | Shows which layout and feedback components form the public package surface. |
| src/…/DesktopShell.vue | Shows the desktop page frame and the relationship between header, content, and scroll ownership. |
| src/…/DesktopShell.md | Explains shell slots, the shared scroll container, and the pane-owned scrolling mode. |
| src/…/MobileShell.vue | Shows the mobile full-screen frame and bottom-navigation boundary. |
| src/…/PageHeaderBase.vue | Shows how page-owned headers render into a shell target and interact with scrolling. |
| src/…/PageHeaderTarget.vue | Shows how a shell-local header target connects page headers to the active shell. |
| src/…/PageHeaderMobile.vue | Shows the fixed mobile header frame and centered title relationship with leading and trailing controls. |
| src/…/PageHeader.vue | Illustrates a page header that combines navigation context with page actions. |
| src/…/Sidebar.md | Explains the composition boundary for the main navigation panel. |
| src/…/Rail.md | Explains the icon rail and its item-level feedback such as badges and tooltips. |
| src/…/ScrollArea.vue | Shows the reusable scroll viewport used by desktop shells and bounded panels. |
| src/…/Divider.vue | Shows the shared separator model and its optional action boundary. |
| src/…/Badge.api.md | Defines the compact status-label choices for theme, variant, size, and content. |
| src/…/Alert.md | Explains the inline status message model and its row-versus-banner behavior. |
| src/…/Alert.vue | Shows the alert lifecycle, action feedback, and semantic status treatment. |
| src/…/Button.vue | Shows the action surface used by alerts, including loading, disabled, and state feedback. |
| src/…/ErrorMessage.vue | Shows the local error display boundary for single and multiple messages. |
| src/…/ServerError.vue | Shows how a failed server action can present multiple local error messages. |
| src/…/toast.ts | Shows the global notification entry point, safe content boundary, and async notification lifecycle. |
| src/…/ToastProvider.vue | Shows direction-aware placement, visible-stack limits, close behavior, and shared toast presentation. |
| src/…/Toast.md | Explains toast setup, result states, actions, duration, updates, promises, and safe message content. |
| src/…/Progress.vue | Shows the measurable completion, range handling, and multi-step feedback model. |