Skip to main content
Layout components provide flexible containers and primitives for organizing content, creating structured interfaces, and managing spacing in WordPress block editor applications.

Flex Layouts

Flex

Flexible box layout container for arranging items horizontally or vertically.
Props:
  • direction?: 'row' | 'column' - Flex direction
  • align?: string - Align items (e.g., ‘center’, ‘flex-start’)
  • justify?: string - Justify content (e.g., ‘space-between’, ‘center’)
  • gap?: number - Spacing between items
  • wrap?: boolean - Allow items to wrap
Sub-components:
  • FlexItem - Fixed-size flex item
  • FlexBlock - Flexible item that fills available space
Storybook: Flex

HStack

Horizontal stack layout (flex row) with consistent spacing.
Props:
  • spacing?: number - Space between items (default: 2)
  • alignment?: 'top' | 'center' | 'bottom' | 'stretch' - Vertical alignment
  • justify?: 'left' | 'center' | 'right' | 'space-between' - Horizontal distribution
Storybook: HStack

VStack

Vertical stack layout (flex column) with consistent spacing.
Props:
  • spacing?: number - Space between items (default: 2)
  • alignment?: 'left' | 'center' | 'right' | 'stretch' - Horizontal alignment
Storybook: VStack

Grid Layouts

Grid

CSS Grid layout container for two-dimensional layouts.
Props:
  • columns?: number | string - Number of columns or template
  • rows?: number | string - Number of rows or template
  • gap?: number - Gap between items
  • columnGap?: number - Horizontal gap
  • rowGap?: number - Vertical gap
  • align?: string - Align items
  • justify?: string - Justify items

Spacing

Spacer

Flexible spacing component for creating gaps between elements.
Props:
  • margin?: number | string - Margin value
  • marginY?: number | string - Vertical margin
  • marginX?: number | string - Horizontal margin
  • marginTop?: number | string
  • marginBottom?: number | string
  • padding?: number | string - Padding value
Storybook: Spacer

Divider

Visual separator between content sections.
Props:
  • margin?: number - Margin around divider
  • marginStart?: number - Start margin
  • marginEnd?: number - End margin

Card Components

Card

Flexible content container with elevation and borders.
Props:
  • size?: 'small' | 'medium' | 'large' - Card size
  • elevation?: number - Shadow depth (0-5)
  • isBorderless?: boolean - Remove border
  • isRounded?: boolean - Rounded corners
Sub-components:
  • CardHeader - Card header section
  • CardBody - Main content area
  • CardFooter - Footer section
  • CardMedia - Media content section
  • CardDivider - Divider between sections
Storybook: Card

Panel Components

Panel

Expandable/collapsible sections container.
Panel Props:
  • header?: string - Panel header text
  • className?: string - Additional CSS class
PanelBody Props:
  • title?: string - Section title
  • icon?: IconType - Title icon
  • initialOpen?: boolean - Initially expanded (default: false)
  • opened?: boolean - Controlled open state
  • onToggle?: (opened: boolean) => void - Toggle handler
PanelRow:
  • Simple wrapper for panel content with consistent spacing
Storybook: Panel

Surface Components

Surface

Base surface component with elevation and borders.

Elevation

Applies shadow/elevation effects to components.

Structural Components

View

Polymorphic base component for custom layouts.

Box

Utility component for spacing and layout control.

Z-Index Management

ZStack

Stacks children along the z-axis.

Responsive Utilities

VisuallyHidden

Hides content visually while keeping it accessible to screen readers.
Storybook: VisuallyHidden

Container Queries

Many layout components support responsive props based on container size. Check individual component documentation in Storybook for container query support.
Layout components are foundational primitives. Prefer using semantic layout components (HStack, VStack, Card) over generic containers (View, Box) for better code readability.

Resources