Skip to content

Expanded & SizedBox

Expanded

A widget that expands a child of a Row, Column, or Flex so that the child fills the available space.

Expanded Flex:1
Expanded Flex:2
vue
<template>
  <Container color="#e0e0e0" :height="60" :padding="EdgeInsets.all(5)">
    <Row>
      <Container :width="50" color="red" />
      <Expanded :flex="1">
        <Container color="green" alignment="center">
          <Text data="Expanded Flex:1" :style="TextStyle({ color: 'white', fontSize: 12 })" />
        </Container>
      </Expanded>
      <Expanded :flex="2">
        <Container color="blue" alignment="center">
          <Text data="Expanded Flex:2" :style="TextStyle({ color: 'white', fontSize: 12 })" />
        </Container>
      </Expanded>
    </Row>
  </Container>
</template>

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

SizedBox & Padding

SizedBox is a box with a specified size. Padding insets its child by the given padding.

Padding
SizedBox
vue
<template>
  <Row>
    <Container color="orange">
      <Padding :all="10">
        <Text data="Padding" :style="TextStyle({ color: 'white' })" />
      </Padding>
    </Container>

    <SizedBox :width="20" />
    <!-- Spacer -->

    <Container color="purple">
      <SizedBox :width="80" :height="40">
        <Center>
          <Text data="SizedBox" :style="TextStyle({ color: 'white' })" />
        </Center>
      </SizedBox>
    </Container>
  </Row>
</template>

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

API

Expanded

Props

NameTypeDefaultDescription
flexnumber1The flex factor to use for this child.
alignSelf'auto' | 'start' | 'end' | 'center' | 'stretch' | 'baseline''auto'How this child should be aligned along the cross axis.
minSizenumber | string-Minimum size of the widget.
maxSizenumber | string-Maximum size of the widget.

Slots

NameDescription
defaultThe child widget.

SizedBox

Props

NameTypeDefaultDescription
widthnumber | string-Width of the widget.
heightnumber | string-Height of the widget.

Slots

NameDescription
defaultThe child widget.

Padding

Props

NameTypeDefaultDescription
allnumber | string-Padding for all sides.
horizontalnumber | string-Padding for left and right.
verticalnumber | string-Padding for top and bottom.
topnumber | string-Padding for top.
bottomnumber | string-Padding for bottom.
leftnumber | string-Padding for left.
rightnumber | string-Padding for right.

Slots

NameDescription
defaultThe child widget.