Veil UI
Components

App Shell

A full-height application frame with a sidebar, header and main area.

Installation

$ npx veil-ui@latest add app-shell

Usage

import { AppShell } from "@/components/ui/app-shell";

<AppShell sidebar={<Sidebar />} header={<Topbar />}>
  <Dashboard />
</AppShell>;

Examples

Basic

Workspace
Main content area.

Header only

Dashboard3 updates

No sidebar in this variant.

Wider sidebar

Workspace
A wider sidebar for dense navigation.

The shell fills the viewport height. The sidebar is hidden below the lg breakpoint so the main area stays usable on mobile.

API reference

PropTypeDefaultDescription
sidebarReact.ReactNode—Persistent sidebar content; hidden below lg.
headerReact.ReactNode—Sticky top bar spanning the full width.
sidebarWidth"sm" | "md" | "lg""md"220, 280 or 340px sidebar at the lg breakpoint.
...propsReact.ComponentProps<"div">—All native div attributes.

Accessibility

  • Renders a main landmark plus an aside when a sidebar is provided.
  • Compose the header and sidebar with real nav, header and heading elements.
  • The mobile story is intentionally simple: hide the sidebar and expose the same navigation elsewhere, for example through a Drawer.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add app-shell --framework vue or switch the framework in components.json.

<script setup lang="ts">
import { cn } from "@/lib/utils";

const sidebarWidths = {
  sm: "lg:grid-cols-[220px_1fr]",
  md: "lg:grid-cols-[280px_1fr]",
  lg: "lg:grid-cols-[340px_1fr]",
} as const;

const props = withDefaults(
  defineProps<{
    sidebarWidth?: keyof typeof sidebarWidths;
    class?: string;
  }>(),
  { sidebarWidth: "md" },
);
</script>

<template>
  <div
    data-slot="app-shell"
    :class="
      cn(
        'grid min-h-dvh grid-rows-[auto_1fr] bg-background',
        props.class,
      )
    "
  >
    <header
      v-if="$slots.header"
      data-slot="app-shell-header"
      class="sticky top-0 z-30 border-b bg-background/80 backdrop-blur"
    >
      <slot name="header" />
    </header>
    <div
      :class="
        cn('grid min-h-0', $slots.sidebar && sidebarWidths[props.sidebarWidth])
      "
    >
      <aside
        v-if="$slots.sidebar"
        data-slot="app-shell-sidebar"
        class="hidden min-h-0 overflow-y-auto border-r bg-muted/20 lg:block"
      >
        <slot name="sidebar" />
      </aside>
      <main data-slot="app-shell-main" class="min-w-0 overflow-x-hidden">
        <slot />
      </main>
    </div>
  </div>
</template>

On this page