WFlexContainer
A utility-first widget that combines a styled WContainer with a WFlex layout, letting you decorate a box and lay out its children in one className.
WFlexContainer(
className: 'flex-col items-center justify-center gap-4 bg-gray-200 dark:bg-gray-800',
children: [
WContainer(
className: 'w-16 h-16 bg-blue-500',
child: WText('Child 1', className: 'text-white'),
),
WContainer(
className: 'w-16 h-16 bg-green-500',
child: WText('Child 2', className: 'text-white'),
),
],
);
Basic Usage
A padded, rounded panel with centered children: A horizontal bar:WFlexContainer is a WContainer wrapping a WFlex, so it accepts both container styling utilities (background, border, padding, sizing) and flex layout utilities (direction, justify, align, gap) in the same className. It is the Wind equivalent of an HTML WFlexContainer(
className: 'flex-col justify-center items-center gap-4 bg-gray-200 dark:bg-gray-800',
children: [
WContainer(className: 'w-full h-10 bg-blue-500'),
WContainer(className: 'w-full h-10 bg-green-500'),
],
);
Constructor
WFlexContainer({
Key? key,
required ListProps
Prop
Type
Default
Description
classNamedynamic''Wind utility class string applied to both the container and the flex layout.
childrenListRequired
The widgets laid out along the main axis.
alignmentAlignmentGeometry?nullContainer alignment; overrides utility-driven alignment.
paddingEdgeInsetsGeometry?nullInner padding of the container.
colorColor?nullContainer background color.
decorationDecoration?nullFull box decoration for the container.
foregroundDecorationDecoration?nullDecoration painted in front of the children.
widthdouble?nullFixed container width.
heightdouble?nullFixed container height.
constraintsBoxConstraints?nullBox constraints for the container.
marginEdgeInsetsGeometry?nullOuter margin of the container.
transformMatrix4?nullTransformation matrix applied to the container.
transformAlignmentAlignmentGeometry?nullOrigin of the
transform.
clipBehaviorClipClip.noneHow content is clipped, applied to both container and flex.
directionAxis?nullMain-axis direction; overrides any
flex-row / flex-col utility.
mainAxisAlignmentMainAxisAlignment?nullMain-axis alignment; overrides any
justify-* utility.
mainAxisSizeMainAxisSize?nullMain-axis size; overrides any
axis-min / axis-max utility.
crossAxisAlignmentCrossAxisAlignment?nullCross-axis alignment; overrides any
items-* utility.
textDirectionTextDirection?nullText direction used to resolve
start / end alignment.
verticalDirectionVerticalDirectionVerticalDirection.downOrder in which children are laid out vertically.
textBaselineTextBaseline?nullBaseline used when cross-axis alignment is baseline.
Supported Utility Classes
Class Type
Example
Documentation
Responsive Design
sm:flex-col, xs:flex-rowResponsive Design
Flex Direction
flex-row, flex-colFlex Direction
Justify Content
justify-center, justify-betweenJustify Content
Align Items
items-start, items-centerAlign Items
Axis Sizes
axis-max, axis-minAxis Sizes
Gap (Spacing)
gap-2, gap-[4]Gap (Spacing)
Flex-x
flex-1, flex-2Flex-x
Flex Fit Classes
flex-grow, flex-autoFlex Fit Classes
Alignment
alignment-top-left, alignment-center-rightAlignment
Padding
p-4, px-[6], py-2Padding
Margin
m-8, mx-[4], my-2Margin
Width
w-10, w-[30]Width
Height
h-10, h-[30]Height
Max-Width & Min-Width
max-w-10, min-w-[50]Max-Width & Min-Width
Max-Height & Min-Height
max-h-10, min-h-[50]Max-Height & Min-Height
Background Color
bg-red-500, bg-[#1abc9c]Background Color
Border Width
border-4, border-[6]Border Width
Border Color
border-red-500, border-[#1abc9c]Border Color
Border Radius
rounded-lg, rounded-fullBorder Radius
Overflow
overflow-scrollOverflow
Shadow
shadow-md, shadow-lgShadow
Display Classes
hide, show, sm:hideDisplay
Styling Examples
WFlexContainer(
className: 'flex-col items-center gap-4 p-4 rounded-lg bg-white shadow-md dark:bg-gray-900',
children: [
WText('Title', className: 'text-lg font-bold text-gray-900 dark:text-white'),
WText('Subtitle', className: 'text-gray-600 dark:text-gray-300'),
],
);
WFlexContainer(
className: 'flex-row justify-between items-center px-4 h-16 bg-gray-100 dark:bg-gray-800',
children: [
WText('Brand', className: 'font-bold text-gray-900 dark:text-white'),
WText('Menu', className: 'text-gray-600 dark:text-gray-300'),
],
);
Related Documentation