Skip to main content

Stack

A vertical flex layout container. A convenience wrapper around Ant Design's Flex with vertical preset.

VEF-specific component. Not part of Ant Design.

When to Use

  • Stack children vertically with consistent spacing.
  • Replace <div style={{ display: 'flex', flexDirection: 'column' }}> with a semantic component.

Basic Usage

import { Stack } from '@vef-framework-react/components';

export default function Demo() {
return (
<Stack gap="middle">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</Stack>
);
}

With Alignment

import { Stack } from '@vef-framework-react/components';

export default function Demo() {
return (
<Stack gap="small" align="center">
<div>Centered Item 1</div>
<div>Centered Item 2</div>
</Stack>
);
}

API

Stack extends all Flex props except vertical and orientation (which are fixed to vertical), plus:

PropTypeDefaultDescription
gap'small' | 'middle' | 'large' | CSSProperties['gap']Gap between children
alignCSSProperties['alignItems']Cross-axis alignment
justifyCSSProperties['justifyContent']Main-axis alignment
wrapCSSProperties['flexWrap']Flex wrap
flexCSSProperties['flex']Flex grow/shrink
classNamestringCSS class
styleCSSPropertiesInline style
refRef<HTMLDivElement>DOM ref

Best Practices

  • Use Stack for vertical layouts and Center for centered content.
  • Prefer named gap sizes ('small', 'middle', 'large') over pixel values for consistency with the design system.