logoRuru UI

Stack

A stack is a container that holds a collection of items in a specific order.

Installation

npx ruru-ui-cli@latest add stack

Usage

direction

Defines the layout direction of the stack. It can be either "row" or "column". Supports responsive breakpoints.

gap

Defines the space between the child elements. Accepts numbers or responsive breakpoints.

align

Controls how child elements are aligned along the cross axis (vertical in a row layout, horizontal in a column layout).

justify

Determines how the elements are distributed along the main axis.

wrap

Allows child elements to wrap onto multiple lines.

padding

Defines the padding around the stack. Supports fixed and responsive values.

margin

Applies margin to the stack element. Supports fixed and responsive values.

grow

Determines how much the stack should grow relative to its siblings.

zIndex

Controls the stack's stacking order on the page.

visibility

Sets the visibility of the stack. Can be "visible", "hidden", or "collapse".

alignContent

Defines how multiple rows of content are aligned along the cross axis.

Example

Combining Multiple Props. Demonstrates the use of multiple props in a stack.

Props

NameTypeDefaultDescription
childrenReactNodeElements to be rendered inside the Stack.
directionResponsive<"row" | "column">"row"Defines the layout direction of the stack.
gapResponsive<number>0Specifies the space between child elements.
alignResponsive<AlignItems>"stretch"Aligns children along the cross axis.
justifyResponsive<JustifyContent>"start"Distributes children along the main axis.
wrapResponsive<Wrap>"nowrap"Controls whether child elements should wrap.
grownumberDetermines how much the stack should grow.
paddingResponsive<Spacing>0Applies padding to the stack.
marginResponsive<Spacing>0Applies margin to the stack.
widthResponsive<number | string>"auto"Sets the width of the stack.
heightResponsive<number | string>"auto"Sets the height of the stack.
borderstringDefines the border for the stack.
borderRadiusstring | numberSpecifies the border radius of the stack.
backgroundColorstringSets the background color of the stack.
maxWidthstring | numberDefines the maximum width of the stack.
maxHeightstring | numberDefines the maximum height of the stack.
alignContentResponsive<AlignContent>"stretch"Aligns rows of content along the cross axis.
zIndexnumberControls the stack's stacking order on the page.
visibilityResponsive<Visibility>"visible"Controls the visibility of the stack.
classNamestringAdditional CSS classes to apply to the stack.
styleCSSPropertiesInline styles to be applied to the stack.

On this page