Skip to content

App Shell

@astryxdesign/core v0.7.1 · AppShell

App Shell Props ​

NameTypeDefaultDescription
variant'wash' | 'surface' | 'section' | 'elevated''elevated'Page background. elevated with both a top nav and a side nav, on a wide viewport, puts the content on a rounded backdrop.
contentPaddingSpacingStep-Padding of the content region. Omit it and the content is flush.
height'fill' | 'auto''fill'fill uses 100dvh. An inline height overrides that length.
mobileNavfalse | AppShellMobileNav-false turns the drawer off. An object sets breakpoint (sm 640, md 768, lg 1024, xl 1280, 2xl 1536, or none), isOpen, and hasToggle.
mobileNavOpenbooleanfalsev-model:mobile-nav-open. The component also emits mobileNavOpenChange.

SpacingStep accepts 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10. The default breakpoint is md, and the query is (width < Npx). hasToggle defaults to true.

Slots ​

NameDescription
defaultPage content, rendered in the main region.
topNavThe top bar, usually a TopNav. On a narrow viewport its items move into the shell drawer.
sideNavThe side bar, usually a SideNav. Below the breakpoint it renders inside the drawer instead of beside the content.
bannerA banner between the navigation and the content.
mobileNavReplaces the default drawer.

useAppShellMobile ​

Import it from @astryx-vue/core. It returns the nearest shell:

NameTypeDescription
isMobilebooleanTrue when the viewport is below the shell breakpoint.
isMobileNavOpenbooleanWhether the drawer is open.
isMobileNavEnabledbooleanFalse outside a shell, or when mobileNav is false.
hasAutoTogglebooleanWhether the shell draws the menu button.
hasSideNavbooleanWhether the side nav slot is set.
mobileNavIdstringId of the drawer. Top nav items teleport into #${id}-items.
toggleMobileNav() => voidToggles the drawer. A no-op outside a shell.
openMobileNav() => voidOpens the drawer.
closeMobileNav() => voidCloses the drawer.

The main region is #astryx-app-shell-main, a div with role="main" and tabindex="-1". The skip link label follows the active locale.

Native attributes ​

AppShell renders a <div>.

The following go to that element:

  • HTML attributes.
  • aria-* attributes.
  • data-* attributes.
  • class.
  • style.

class is merged. The root sets data-variant and data-height.