Row
Row arranges children horizontally in a single row, mirroring Flutter's Row widget. It provides precise control over horizontal alignment, spacing, RTL support, and layout behavior using a declarative API built on CSS Flexbox.

Tsx

import { Row } from '@dynshift/layr';

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
1. Basic Usage
1a. Simple Horizontal Layout

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
1b. With Spacing

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
2. Main Axis Alignment
The mainAxisAlignment prop controls how children are distributed along the horizontal axis.
2a. Start (Default)
Children are placed at the start (left for LTR, right for RTL):

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
2b. Center
Children are centered horizontally:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
2c. End
Children are placed at the end (right for LTR, left for RTL):

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
2d. Space Between
Remaining space is distributed evenly between children:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
2e. Space Around
Space is distributed evenly around each child:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
2f. Space Evenly
Space is distributed evenly, including edges:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
Available values:
MainAxisAlignment.start — Left (LTR) / Right (RTL) • MainAxisAlignment.center — Horizontal center • MainAxisAlignment.end — Right (LTR) / Left (RTL) • MainAxisAlignment.spaceBetween — Space between children • MainAxisAlignment.spaceAround — Space around children • MainAxisAlignment.spaceEvenly — Even spacing including edges
3. Cross Axis Alignment
The crossAxisAlignment prop controls how children are aligned vertically.
3a. Center (Default)
Children are centered vertically:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3b. Start (Top)
Children are aligned to the top edge:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3c. End (Bottom)
Children are aligned to the bottom edge:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3d. Stretch
Children are stretched to fill the full height:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
3e. Baseline
Children are aligned by their text baseline:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
Available values:
CrossAxisAlignment.center — Vertical center (default) • CrossAxisAlignment.start — Top alignment • CrossAxisAlignment.end — Bottom alignment • CrossAxisAlignment.stretch — Fill full height • CrossAxisAlignment.baseline — Baseline alignment
4. Main Axis Size
The mainAxisSize prop controls how much horizontal space the row occupies.
4a. Max (Default)
Row takes up all available width:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
This sets width: 100% on the row.
4b. Min
Row wraps to fit its children's width:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
This sets width: auto on the row.
Use cases:
MainAxisSize.max — Full-width navbars and headers • MainAxisSize.min — Inline buttons, badges, chips
5. Text Direction (RTL Support)
Control whether children are laid out left-to-right or right-to-left.
5a. LTR (Default)
Normal left-to-right order:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
5b. RTL (Right-to-Left)
Right-to-left order for Arabic, Hebrew, etc.:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
This applies flex-direction: row-reverse.
6. Spacing
Add consistent gaps between children using the spacing prop.
6a. Fixed Spacing

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
This uses CSS gap for clean implementation.
6b. No Spacing (Default)

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
Note: spacing only affects gaps between children, not margins around the row itself.
7. Clip Behavior
Control how overflowing content is handled.
7a. Visible (Default)
Content can overflow the row boundaries:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
7b. Hidden
Clip overflowing content:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
7c. Scroll
Enable scrolling for overflowing content:

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
Important: Row does not scroll by default. If children overflow, consider using clipBehavior="scroll" or a scrollable container.
8. Complete Examples
8a. Navigation Bar

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
8b. Icon + Text Button

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
8c. Form Input with Label

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
8d. Badge List

Tsx

Preview

NOTE: Previews are not depiction of actual website output.

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
8f. Card Header

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
8g. Toolbar

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
8h. User Profile Row

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
8i. Stat Cards

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
8j. Breadcrumbs

Tsx

Preview

NOTE: Previews are not depiction of actual website output.
9. Layout Algorithm
Row follows Flutter's layout specification:
• Layout non-flex children with unbounded horizontal constraints • Divide remaining horizontal space among flex children (Expanded) • Height = maximum height of children • Width = determined by mainAxisSize (max = fill parent, min = wrap content) • Position children according to mainAxisAlignment and crossAxisAlignment
10. Custom Styling
10a. Tailwind Classes

Tsx

<Row className="bg-gray-100 rounded-lg p-4">
<span>Styled with Tailwind</span>
</Row>
10b. Inline Styles

Tsx

<Row
style={{
backgroundColor: '#f3f4f6',
borderRadius: '8px',
padding: '16px'
}}
>
<span>Custom styles</span>
</Row>
11. TypeScript
Row is fully typed with comprehensive IntelliSense support:

Tsx

import type { RowProps } from '@dynshift/layr';
import { Row, MainAxisAlignment, CrossAxisAlignment } from '@dynshift/layr';
const HorizontalList: React.FC<RowProps> = (props) => {
return (
<Row
mainAxisAlignment={MainAxisAlignment.start}
crossAxisAlignment={CrossAxisAlignment.center}
spacing={12}
{...props}
/>
);
};
12. API Reference
12a. RowProps
PropTypeDefaultDescription
childrenReactNodeContent to render horizontally
mainAxisAlignmentMainAxisAlignmentstartHorizontal distribution of children
crossAxisAlignmentCrossAxisAlignmentcenterVertical alignment of children
mainAxisSizeMainAxisSizemaxHow much horizontal space to occupy
textDirectionTextDirectionltrLayout direction (LTR or RTL)
spacingnumber0Gap between children in pixels
clipBehavior'visible' 'hidden' 'scroll''visible'How to handle overflow
classNamestring''Additional CSS classes
styleCSSProperties{}Custom inline styles
idstringHTML id attribute
onTap() => voidClick handler (Flutter-style)
onClick() => voidClick handler
12b. MainAxisAlignment Enum
ValueCSS EquivalentDescription
startflex-startLeft (LTR) / Right (RTL)
centercenterHorizontal center
endflex-endRight (LTR) / Left (RTL)
spaceBetweenspace-betweenSpace between children
spaceAroundspace-aroundSpace around children
spaceEvenlyspace-evenlyEven spacing
12c. CrossAxisAlignment Enum
ValueCSS EquivalentDescription
startflex-startTop alignment
centercenterVertical center
endflex-endBottom alignment
stretchstretchFill full height
baselinebaselineText baseline alignment
12d. MainAxisSize Enum
ValueBehaviorDescription
maxwidth: 100%Fill available width
minwidth: autoWrap to content width
12e. TextDirection Enum
ValueCSS EquivalentDescription
ltrrowLeft-to-right (normal)
rtlrow-reverseRight-to-left (reversed)
13. Next Steps
• Stack — Layered positioning • Positioned — Positioned children • SizedBox — Fixed-size widget