EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
Layout·component·@astryxdesign/core

Layout

General five-slot layout primitive for arranging header, start, content, end, and footer regions.

Open in Playground @astryxdesign/core/Layout

Showcases and examples

7 documented examples

Layout

Layout API entry

Preview loads on approachPreview loads on approach
Exact source · layout-showcase
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {
  Layout,
  LayoutHeader,
  LayoutContent,
  LayoutFooter,
  LayoutPanel,
  HStack,
  VStack,
} from '@astryxdesign/core/Layout';
import {Section} from '@astryxdesign/core/Section';
import {Text, Heading} from '@astryxdesign/core/Text';
import {Button} from '@astryxdesign/core/Button';
import {Badge} from '@astryxdesign/core/Badge';
import {List, ListItem} from '@astryxdesign/core/List';

export default function LayoutShowcase() {
  return (
    <Section padding={4}>
      <Layout
        height="fill"
        header={
          <LayoutHeader hasDivider>
            <HStack gap={2} vAlign="center">
              <Heading level={4}>Projects</Heading>
              <Badge variant="info" label="3 active" />
            </HStack>
          </LayoutHeader>
        }
        start={
          <LayoutPanel hasDivider width={140}>
            <List>
              <ListItem label="Dashboard" isSelected />
              <ListItem label="Analytics" />
              <ListItem label="Settings" />
            </List>
          </LayoutPanel>
        }
        content={
          <LayoutContent>
            <VStack gap={2}>
              <Heading level={5}>Welcome back</Heading>
              <Text type="body" color="secondary">
                You have 3 active projects and 2 pending reviews.
              </Text>
            </VStack>
          </LayoutContent>
        }
        footer={
          <LayoutFooter hasDivider>
            <HStack gap={2} hAlign="end">
              <Button label="New Project" variant="primary">
                New Project
              </Button>
            </HStack>
          </LayoutFooter>
        }
      />
    </Section>
  );
}

Usage

Layout is a general five-slot primitive for arranging header, start, content, end, and footer regions within a page or bounded container. AppShell owns the page shell and app-wide navigation behavior; use HStack or VStack for simple directional stacking.

  • Use Layout when content needs named header, start, content, end, or footer regions.
  • Use HStack and VStack for simple directional stacking within a content area.
  • Use Layout for simple stacking layouts; use HStack or VStack instead.
  • Use Layout as the page shell or for app-wide navigation; use AppShell for that responsibility.

Typed props

PropType and behavior
contentReactNode
Content slot (center). Accepts any ReactNode; use LayoutContent when a content region is needed. Children passed to <Layout> render here too: <Layout>{main}</Layout> is shorthand for <Layout content={main} />.
headerReactNode
Header slot. Accepts any ReactNode; use LayoutHeader when a header region is needed.
footerReactNode
Footer slot. Accepts any ReactNode; use LayoutFooter when a footer region is needed.
startReactNode
Logical-start slot (left in LTR). Accepts any ReactNode; use LayoutPanel when a panel region is needed.
endReactNode
Logical-end slot (right in LTR). Accepts any ReactNode; use LayoutPanel when a panel region is needed.
height'fill' | 'auto' · default 'fill'
Height behavior: fill the container or grow with content.
contentWidthSizeValue
Maximum width of the aligned content within each slot (header, content, footer, panels), centered when narrower than the available space. Without panels, LayoutContent spans the available width so its scrollbar stays at the outer edge while its children align internally to contentWidth. With exactly one panel, the panel stays aligned to the contentWidth frame while LayoutContent extends to the opposite open edge. With both panels, contentWidth includes the complete middle composition. Percentage widths—including percentage-bearing calc(), min(), max(), and clamp() values—and intrinsic widths, plus bare var(...) values, retain the constrained composition; use calc(var(...)) for a variable guaranteed to resolve to a length. Dividers stay full-bleed. Numbers are treated as pixels, strings are used as-is (e.g. 60ch). Common page widths: 640 for forms, settings, and text-focused pages; 960 for content pages and wider layouts.
padding0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10
Padding at the layout's outer edges using the spacing scale.
defaultHasDividersboolean
Default divider visibility for LayoutHeader and LayoutFooter children. Headers and footers that don't pass hasDivider use this value; when unset, nested layouts inherit from their parent context.

Anatomy

Layout container · required

General layout primitive that places the header, start, content, end, and footer slots.

Header · optional

Optional LayoutHeader region supplied by the caller, typically in the header slot.

Panel · optional

Optional LayoutPanel region supplied by the caller in the start or end slot.

Content area · optional

Optional LayoutContent region supplied by the caller in the content slot.

Footer · optional

Optional LayoutFooter region supplied by the caller, typically in the footer slot.

Theming

Targets

astryx-layout

Visual props: height

astryx-layout-content
astryx-layout-footer
astryx-layout-header
astryx-layout-panel