Skip to main content

Container

Flexible layout container with comprehensive styling, border, and safe area support.

Basic Usage

import { Container } from '@multinaire/ui';

<Container padding={16} gap={8}>
{/* Content */}
</Container>

Props

PropTypeDefaultDescription
styleViewStyleAdditional styles applied to the container
marginSpacingPropsOuter margin. Accepts a number for uniform margin, or an object for per-side control
paddingSpacingPropsInner padding. Accepts a number for uniform padding, or an object for per-side control
widthDimensionValueFixed width of the container
heightDimensionValueFixed height of the container
borderRadiusBorderRadiusPropsBorder radius. Accepts a number for uniform radius or an object for per-corner control
backgroundColorColorKeysBackground color key from the active theme palette
bordernumberBorder width in pixels. Use together with borderColor for a visible border
borderColorColorKeysBorder color key from the active theme palette
flexnumberFlex grow value
horizontalbooleanfalseSet to true to lay out children in a row (horizontal). Defaults to column
justifyContentstringJustify content along the main axis
alignItemsstringAlign items along the cross axis
gapnumberGap between children in pixels
safeAreaEdgesEdgesSafe area edges to inset. Renders as SafeAreaView when provided. Cannot be combined with onPress
testIDstringTest identifier for UI automation
onLayoutfunctionCallback invoked when the layout changes
onPress() => voidPress handler. Renders as Pressable when provided. Cannot be combined with safeAreaEdges

Examples

Vertical Layout (Default)

<Container gap={16} padding={16}>
<Typography>Item 1</Typography>
<Typography>Item 2</Typography>
<Typography>Item 3</Typography>
</Container>

Horizontal Layout

<Container horizontal gap={8} alignItems="center">
<Icon icon="Star1" />
<Typography>Horizontal items</Typography>
</Container>

Centered Content

<Container flex={1} justifyContent="center" alignItems="center">
<Typography>Centered</Typography>
</Container>

With Background Color

<Container backgroundColor="backgroundVariant" padding={16} borderRadius={8}>
<Typography>Surface background</Typography>
</Container>

With Border

<Container border={1} borderColor="primary" padding={16} borderRadius={8}>
<Typography>Outlined container</Typography>
</Container>

Safe Area Support

<Container safeAreaEdges={['top', 'bottom']}>
{/* Content respects safe areas */}
</Container>

Pressable Container

<Container padding={16} backgroundColor="backgroundVariant" onPress={() => handlePress()}>
<Typography>Tap me</Typography>
</Container>

When onPress is set the container renders as a Pressable and animates its opacity on hover (web/desktop) and press.