Stack
Stack is a layout component that creates responsive horizontal and vertical flows.
Page navigation navigation
Accessibility and usability expectations
Presentation
Cognition
Stackhelps enforce consistent layout patterns, which supports user understanding across pages- Logical stacking order (
verticalorhorizontal) contributes to content clarity and reduces cognitive load - Proper spacing between elements can visually group related content, aiding in comprehension
Vision
Stackallows for clear separation of elements via configurable spacing (gap)- Ensure child components maintain appropriate color contrast and legible font sizes for visibility
Mobility
Stackdoes not interfere with tab order or focus styles- Spacing can improve touch target separation for users with motor challenges
- Avoid using
Stackin a way that introduces layout shifts or off-screen content when navigating by keyboard
Adaptability
Stacksupports responsive direction and gap properties, ensuring layout adjusts well to different screen sizes- Layout remains functional and readable at high zoom levels or on narrow viewports (e.g., 320px wide)
- Directional props (direction) help content reflow logically in responsive scenarios
Interaction
Keyboard
Stackitself does not include any interactive elements or keyboard behaviour
Engineering for AT Compatibility
Screen reader
Stackdoes not render semantic HTML or appear in the accessibility tree by default- Accessibility depends entirely on the semantics of child elements (e.g. heading levels, ARIA roles)
- Ensure content inside
Stackis logically ordered for screen reader reading flow
Speech recognition
Stackdoes not affect speech navigation- Avoid using
Stackto wrap unrelated interactive elements without clear groupings
Built-in accessibility features
Stackprovides no inherent accessibility features; it is a layout-only utility- Its
gapandalignproperties help support accessible visual spacing and content grouping
Implementation requirements
- Use semantic HTML within
Stackto convey meaningful content structure - Ensure that spacing and layout do not interfere with focus indicators or screen reader reading order
- Avoid using
Stackto group interactive controls unless they are contextually related - Combine with ARIA roles or landmarks only when wrapping semantically relevant sections (e.g. navigation, form groups)
How to test the component
Integration tests
- Verify that child content maintains logical tab order and reading order
- Ensure layout reflows properly at different screen widths and zoom levels
- Confirm that spacing and layout support content grouping and clarity
- If used to display dynamic content, check that focus and announcements are handled by the child components
Component tests
- Rendering with various
gapanddirectionprops results in expected layout - Layout is preserved when child elements have variable content sizes
Stackdoes not introduce semantic or accessibility tree changes on its own- Responsive behaviour adjusts spacing and direction appropriately