Skip to content

Box

A convenience widget that combines common painting, positioning, and sizing widgets. It is similar to Container but allows passing decoration properties (border, borderRadius, boxShadow, etc.) directly as props, without needing a BoxDecoration object.

Usage

Box
Circle
vue
<template>
  <Column :gap="20">
    <Box
      :width="100"
      :height="100"
      color="lightblue"
      :border-radius="BorderRadius.circular(10)"
      :box-shadow="[BoxShadow({ blurRadius: 10, color: 'rgba(0,0,0,0.1)' })]"
    >
      <Center>
        <Text data="Box" />
      </Center>
    </Box>

    <Box
      :width="100"
      :height="100"
      :border="Border.all({ color: 'blue', width: 2 })"
      shape="circle"
    >
      <Center>
        <Text data="Circle" />
      </Center>
    </Box>
  </Column>
</template>

<script setup lang="ts">
import { Box, Column, Center, Text, BorderRadius, Border, BoxShadow } from "fluekit";
</script>

API

Props

NameTypeDefaultDescription
widthnumber | string-Width of the box.
heightnumber | string-Height of the box.
paddingEdgeInsets-Empty space to inscribe inside the box.
marginEdgeInsets-Empty space to surround the box.
colorstring-Background color.
borderBorder-Border around the box.
borderRadiusBorderRadius-Border radius of the box.
boxShadowBoxShadow[]-Shadows to cast behind the box.
shape'rectangle' | 'circle''rectangle'Shape of the box.
alignmentAlignment-Align the child within the box.
clipBehaviorClip'none'The clip behavior when decoration is set.
gradientstring-Background gradient (CSS string).
imageDecorationImage-Background image.