EXEPERTAI LAB

Research alpha

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

Section

Section is the correct way to create page regions and group related content on a page. Use it for settings groups, form sections, sidebar areas, or any time you need visual separation between parts of a page. If you are tempted to use a Card for a page section, use Section instead.

Open in Playground @astryxdesign/core/Section

Showcases and examples

3 documented examples

Section — Variants

All three background variants stacked: section (default surface), muted, and transparent. A quick visual reference for choosing the right variant.

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

'use client';

import {Section} from '@astryxdesign/core/Section';
import {Stack} from '@astryxdesign/core/Layout';
import {Text} from '@astryxdesign/core/Text';

export default function SectionVariants() {
  return (
    <Stack direction="vertical" gap={6}>
      <Section variant="section" padding={5}>
        <Stack direction="vertical" gap={1}>
          <Text type="body" weight="bold">
            Section
          </Text>
          <Text type="supporting" color="secondary">
            White background.
          </Text>
        </Stack>
      </Section>
      <Section variant="muted" padding={5}>
        <Stack direction="vertical" gap={1}>
          <Text type="body" weight="bold">
            Wash
          </Text>
          <Text type="supporting" color="secondary">
            Gray background.
          </Text>
        </Stack>
      </Section>
      <Stack direction="vertical">
        <Section variant="transparent" padding={5}>
          <Stack direction="vertical" gap={1}>
            <Text type="body" weight="bold">
              Transparent
            </Text>
            <Text type="supporting" color="secondary">
              No background, shows the color behind it.
            </Text>
          </Stack>
        </Section>
      </Stack>
    </Stack>
  );
}

Usage

Section is the correct way to create page regions and group related content on a page. Use it for settings groups, form sections, sidebar areas, or any time you need visual separation between parts of a page. If you are tempted to use a Card for a page section, use Section instead.

  • Use Section for page-level grouping: settings panels, form groups, sidebar regions. These are sections of a page, not discrete items.
  • Start with the default variant. Use muted only to call attention to a specific region.
  • Add dividers between same-background sections that need separation.
  • Combine with a heading + Stack for a typical page section pattern.
  • Use Card when you mean Section. Cards are for discrete items (one notification, one profile). Sections are for page regions.

Typed props

PropType and behavior
variant'section' | 'transparent' | 'muted' · default 'section'
Background variant applied to the section container.
widthSizeValue
Width of the section; a number is interpreted as pixels, a string is used as-is.
heightSizeValue
Height of the section; a number is interpreted as pixels, a string is used as-is.
maxWidthSizeValue
Maximum width of the section.
minHeightSizeValue
Minimum height of the section.
childrenReactNode
Content rendered inside the section.
dividersArray<'top' | 'bottom' | 'start' | 'end'>
Which sides of the section have divider borders.
padding0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10 · default 4
Internal padding using the spacing scale (0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10). Use padding={0} for edge-to-edge content.
paddingInline0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10
Inline (horizontal) padding override. Overrides only the inline-axis padding while preserving block padding from padding or the container theme default. Accepts the spacing scale (0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10).
paddingInlineStart0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10
Inline-start padding override (left in LTR, right in RTL). Overrides paddingInline and padding on that edge only.
paddingInlineEnd0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10
Inline-end padding override (right in LTR, left in RTL). Overrides paddingInline and padding on that edge only.
paddingBlock0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10
Block (vertical) padding override. Overrides only the block-axis padding while preserving inline padding from padding or the container theme default. Accepts the spacing scale (0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10).
paddingBlockStart0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10
Block-start (top) padding, using the spacing scale. Overrides paddingBlock and padding on that edge only.
paddingBlockEnd0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10
Block-end (bottom) padding, using the spacing scale. Overrides paddingBlock and padding on that edge only.
xstyleStyleXStyles
StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value, not an inline style object.

Anatomy

Section container · required

Painted container that groups a page region.

Consumer content · optional

Caller-provided content rendered inside the section container.

Theming

Container theming is enabled.

Targets

astryx-section

Visual props: variant

Derived properties

padding

Expands: container