Skip to content

Layout

@astryxdesign/core v0.7.1 · Layout

Layout Props ​

NameTypeDefaultDescription
contentWidthnumber | string-Maximum width of the aligned content. Dividers stay full width. Numbers are pixels. A percentage, fit-content, max-content, min-content, or a bare var() uses constrained width.
height'fill' | 'auto''fill'fill stretches to the container and scrolls the content. auto grows with the content.
paddingSpacingStep-Outer inset for this layout only. It does not pass to a nested layout. 0 is full bleed.
defaultHasDividersboolean-Fallback for a header or footer that does not set hasDivider.

SpacingStep accepts 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10.

Layout Slots ​

NameDescription
defaultThe content region. Put a LayoutContent here.
headerThe top region. Put a LayoutHeader here.
startThe inline-start region. Put a LayoutPanel here, and a ResizeHandle beside it when the panel resizes.
endThe inline-end region.
footerThe bottom region. Put a LayoutFooter here.

Layout Header Props ​

NameTypeDefaultDescription
hasDividerbooleaninheritedBorder on the bottom edge. Omit it to use defaultHasDividers, which is false when the layout does not set one.
heightnumber | string-Height. Numbers are pixels, strings are used as they are.
paddingSpacingStep-Padding. 0 lets the content own its inset.
paddingBlockEndSpacingStep-Bottom padding only, so a tab underline can meet the divider.
labelstring-Accessible name when role is set.
roleAriaRole-ARIA landmark role.

LayoutHeader has a default slot for its content.

LayoutFooter accepts hasDivider, height, padding, label, and role with the same meaning as the header. hasDivider draws the border on the top edge. It has a default slot.

Layout Content Props ​

NameTypeDefaultDescription
paddingSpacingStep-Padding. 0 lets a child such as Section reach the edges.
isScrollablebooleantrueScroll this region when the content overflows.
labelstring-Accessible name when role is set.
roleAriaRole-ARIA landmark role.

LayoutContent has a default slot.

Layout Panel Props ​

NameTypeDefaultDescription
hasDividerbooleanfalseBorder on the edge that faces the content. Leave it off when a ResizeHandle draws that line.
paddingSpacingStep-Padding. Omit it and a panel without a divider collapses the margin that faces the content.
isScrollablebooleantrueScroll this panel when the content overflows.
widthnumber | string-Width. Numbers are pixels. Ignored while resizable is set.
resizableLayoutResizable-The props object from useResizable. The panel width follows _size, and the object also carries the region's axis as _direction ('horizontal' | 'vertical'), which must match the adjacent ResizeHandle.
labelstring-Accessible name when role is set.
roleAriaRole-ARIA landmark role, for example navigation.

LayoutPanel has a default slot.

Native attributes ​

Each piece renders a <div>.

The following go to its root:

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

class is merged. Layout sets data-height.