Skip to content

Row & Column

Flex layouts for horizontal and vertical arrangement.

Basic Usage

1
2
3
vue
<template>
  <Container
    color="#f0f0f0"
    :padding="EdgeInsets.all(10)"
    :margin="EdgeInsets.only({ bottom: 20 })"
  >
    <Column mainAxisSize="min">
      <Row mainAxisAlignment="space-between" :margin="EdgeInsets.only({ bottom: 10 })">
        <Container :width="50" :height="50" color="red" alignment="center"
          ><Text data="1" :style="TextStyle({ color: 'white' })"
        /></Container>
        <Container :width="50" :height="50" color="green" alignment="center"
          ><Text data="2" :style="TextStyle({ color: 'white' })"
        /></Container>
        <Container :width="50" :height="50" color="blue" alignment="center"
          ><Text data="3" :style="TextStyle({ color: 'white' })"
        /></Container>
      </Row>
    </Column>
  </Container>
</template>

<script setup lang="ts">
import { Container, Column, Row, Text, TextStyle, EdgeInsets } from "fluekit";
</script>

Alignment

Control main axis and cross axis alignment.

Align(bottomRight) vs Center
vue
<template>
  <Row :gap="20">
    <Container :width="100" :height="100" color="#ddd">
      <Align alignment="bottomRight">
        <Container :width="30" :height="30" color="red" />
      </Align>
    </Container>
    <Container :width="100" :height="100" color="#ddd">
      <Center>
        <Container :width="30" :height="30" color="blue" />
      </Center>
    </Container>
  </Row>
  <Container :margin="EdgeInsets.only({ top: 5 })">
    <Text data="Align(bottomRight) vs Center" :style="TextStyle({ fontSize: 12, color: 'grey' })" />
  </Container>
</template>

<script setup lang="ts">
import { Container, Row, Align, Center, Text, TextStyle, EdgeInsets } from "fluekit";
</script>

MainAxisAlignment Examples

MainAxisAlignment.spaceBetween
1
2
3
MainAxisAlignment.spaceAround
1
2
3
MainAxisAlignment.spaceEvenly
1
2
3
vue
<template>
  <Container :width="300" :height="150" color="#f0f0f0" :padding="EdgeInsets.all(10)">
    <Text data="MainAxisAlignment.spaceBetween" :style="TextStyle({ marginBottom: '10px' })" />
    <Row mainAxisAlignment="spaceBetween" :margin="EdgeInsets.only({ bottom: '10px' })">
      <Container :width="40" :height="40" color="red" alignment="center"
        ><Text data="1" :style="TextStyle({ color: 'white' })"
      /></Container>
      <Container :width="40" :height="40" color="green" alignment="center"
        ><Text data="2" :style="TextStyle({ color: 'white' })"
      /></Container>
      <Container :width="40" :height="40" color="blue" alignment="center"
        ><Text data="3" :style="TextStyle({ color: 'white' })"
      /></Container>
    </Row>

    <Text data="MainAxisAlignment.spaceAround" :style="TextStyle({ marginBottom: '10px' })" />
    <Row mainAxisAlignment="spaceAround" :margin="EdgeInsets.only({ bottom: '10px' })">
      <Container :width="40" :height="40" color="red" alignment="center"
        ><Text data="1" :style="TextStyle({ color: 'white' })"
      /></Container>
      <Container :width="40" :height="40" color="green" alignment="center"
        ><Text data="2" :style="TextStyle({ color: 'white' })"
      /></Container>
      <Container :width="40" :height="40" color="blue" alignment="center"
        ><Text data="3" :style="TextStyle({ color: 'white' })"
      /></Container>
    </Row>

    <Text data="MainAxisAlignment.spaceEvenly" :style="TextStyle({ marginBottom: '10px' })" />
    <Row mainAxisAlignment="spaceEvenly">
      <Container :width="40" :height="40" color="red" alignment="center"
        ><Text data="1" :style="TextStyle({ color: 'white' })"
      /></Container>
      <Container :width="40" :height="40" color="green" alignment="center"
        ><Text data="2" :style="TextStyle({ color: 'white' })"
      /></Container>
      <Container :width="40" :height="40" color="blue" alignment="center"
        ><Text data="3" :style="TextStyle({ color: 'white' })"
      /></Container>
    </Row>
  </Container>
</template>

<script setup lang="ts">
import { Container, Row, Text, TextStyle, EdgeInsets } from "fluekit";
</script>

ColumnAxisAlignment Examples

MainAxisAlignment.start
1
2
3
MainAxisAlignment.center
1
2
3
MainAxisAlignment.end
1
2
3
vue
<template>
  <Row :gap="20">
    <Container :width="100" :height="200" color="#f0f0f0" :padding="EdgeInsets.all(10)">
      <Text
        data="MainAxisAlignment.start"
        :style="TextStyle({ marginBottom: '10px', fontSize: '12px' })"
      />
      <Column mainAxisAlignment="start" :height="150">
        <Container :width="30" :height="30" color="red" alignment="center"
          ><Text data="1" :style="TextStyle({ color: 'white', fontSize: '12px' })"
        /></Container>
        <Container :width="30" :height="30" color="green" alignment="center"
          ><Text data="2" :style="TextStyle({ color: 'white', fontSize: '12px' })"
        /></Container>
        <Container :width="30" :height="30" color="blue" alignment="center"
          ><Text data="3" :style="TextStyle({ color: 'white', fontSize: '12px' })"
        /></Container>
      </Column>
    </Container>

    <Container :width="100" :height="200" color="#f0f0f0" :padding="EdgeInsets.all(10)">
      <Text
        data="MainAxisAlignment.center"
        :style="TextStyle({ marginBottom: '10px', fontSize: '12px' })"
      />
      <Column mainAxisAlignment="center" :height="150">
        <Container :width="30" :height="30" color="red" alignment="center"
          ><Text data="1" :style="TextStyle({ color: 'white', fontSize: '12px' })"
        /></Container>
        <Container :width="30" :height="30" color="green" alignment="center"
          ><Text data="2" :style="TextStyle({ color: 'white', fontSize: '12px' })"
        /></Container>
        <Container :width="30" :height="30" color="blue" alignment="center"
          ><Text data="3" :style="TextStyle({ color: 'white', fontSize: '12px' })"
        /></Container>
      </Column>
    </Container>

    <Container :width="100" :height="200" color="#f0f0f0" :padding="EdgeInsets.all(10)">
      <Text
        data="MainAxisAlignment.end"
        :style="TextStyle({ marginBottom: '10px', fontSize: '12px' })"
      />
      <Column mainAxisAlignment="end" :height="150">
        <Container :width="30" :height="30" color="red" alignment="center"
          ><Text data="1" :style="TextStyle({ color: 'white', fontSize: '12px' })"
        /></Container>
        <Container :width="30" :height="30" color="green" alignment="center"
          ><Text data="2" :style="TextStyle({ color: 'white', fontSize: '12px' })"
        /></Container>
        <Container :width="30" :height="30" color="blue" alignment="center"
          ><Text data="3" :style="TextStyle({ color: 'white', fontSize: '12px' })"
        /></Container>
      </Column>
    </Container>
  </Row>
</template>

<script setup lang="ts">
import { Container, Row, Column, Text, TextStyle, EdgeInsets } from "fluekit";
</script>

Fixed Size Children

Scroll the page to see the Fixed element
Fixed Badge
vue
<template>
  <Container :width="300" :height="100" color="#eee">
    <Center>
      <Text data="Scroll the page to see the Fixed element" />
    </Center>
    <!-- Fixed element is relative to viewport -->
    <Fixed :bottom="20" :right="20" :zIndex="1000">
      <Container
        :padding="EdgeInsets.all(10)"
        :decoration="BoxDecoration({ borderRadius: BorderRadius.all(20), color: 'black' })"
      >
        <Text data="Fixed Badge" :style="TextStyle({ color: 'white' })" />
      </Container>
    </Fixed>
  </Container>
</template>

<script setup lang="ts">
import {
  Container,
  Center,
  Fixed,
  Text,
  BoxDecoration,
  BorderRadius,
  EdgeInsets,
  TextStyle,
} from "fluekit";
</script>

Wrap

A widget that displays its children in multiple horizontal or vertical runs.

1
2
3
4
5
6
7
8
vue
<template>
  <Container color="#f9f9f9" :padding="EdgeInsets.all(10)" :width="300">
    <Wrap :spacing="10" :runSpacing="10">
      <Container v-for="i in 8" :key="i" :width="60" :height="40" color="teal" alignment="center">
        <Text :data="i" :style="TextStyle({ color: 'white' })" />
      </Container>
    </Wrap>
  </Container>
</template>

<script setup lang="ts">
import { Container, Wrap, Text, TextStyle, EdgeInsets } from "fluekit";
</script>

API

Row

Props

NameTypeDefaultDescription
mainAxisAlignmentMainAxisAlignment'start'How the children should be placed along the main axis.
crossAxisAlignmentCrossAxisAlignment'center'How the children should be placed along the cross axis.
wrapbooleanfalseWhether the children should wrap.
gapnumber | string-The gap between children.
expandedbooleanfalseWhether to expand to fill the available space.

Slots

NameDescription
defaultThe children widgets.

Column

Props

NameTypeDefaultDescription
mainAxisAlignmentMainAxisAlignment'start'How the children should be placed along the main axis.
crossAxisAlignmentCrossAxisAlignment'center'How the children should be placed along the cross axis.
wrapbooleanfalseWhether the children should wrap.
gapnumber | string-The gap between children.
expandedbooleanfalseWhether to expand to fill the available space.

Slots

NameDescription
defaultThe children widgets.

Align

Props

NameTypeDefaultDescription
alignmentFlexAlignment'center'How to align the child.
widthFactornumber-If non-null, sets its width to the child's width multiplied by this factor.
heightFactornumber-If non-null, sets its height to the child's height multiplied by this factor.

Slots

NameDescription
defaultThe child widget.

Center

Props

NameTypeDefaultDescription
widthFactornumber-If non-null, sets its width to the child's width multiplied by this factor.
heightFactornumber-If non-null, sets its height to the child's height multiplied by this factor.

Slots

NameDescription
defaultThe child widget.

Fixed

Props

NameTypeDefaultDescription
topnumber | string-Distance from the top.
bottomnumber | string-Distance from the bottom.
leftnumber | string-Distance from the left.
rightnumber | string-Distance from the right.
widthnumber | string-Width of the widget.
heightnumber | string-Height of the widget.
zIndexnumber | string100The z-index of the widget.

Slots

NameDescription
defaultThe child widget.

Wrap

Props

NameTypeDefaultDescription
direction'horizontal' | 'vertical''horizontal'The direction to use as the main axis.
alignment'start' | 'end' | 'center' | 'spaceBetween' | 'spaceAround' | 'spaceEvenly''start'How the children within a run should be placed in the main axis.
spacingnumber | string0How much space to place between children in a run in the main axis.
runAlignment'start' | 'end' | 'center' | 'spaceBetween' | 'spaceAround' | 'spaceEvenly''start'How the runs themselves should be placed in the cross axis.
runSpacingnumber | string0How much space to place between the runs in the cross axis.
crossAxisAlignment'start' | 'end' | 'center''start'How the children within a run should be aligned relative to each other in the cross axis.
verticalDirection'down' | 'up''down'The direction to use as the cross axis.
clipBehavior'none' | 'hardEdge' | 'antiAlias''none'The content will be clipped (or not) according to this option.

Slots

NameDescription
defaultThe children widgets.