Components
Flex
An alias of Stack for teams that prefer a flexbox name.
Installation
$ npx veil-ui@latest add flexUsage
import { Flex } from "@/components/ui/flex";
<Flex direction="row" justify="between" align="center">
<span>Left</span>
<span>Right</span>
</Flex>;Examples
Basic
Space between
Storage2.4 GB of 5 GB
Flex is a re-export of Stack. Install stack alongside it; there is only one
implementation to maintain.
API reference
See Stack for the full API: direction, gap,
align, justify and wrap.
Accessibility
- Presentational flex wrapper; it adds no ARIA roles or landmarks.
- All layout props map to static classes, so they are visible to Tailwind's compiler.
Vue and plain HTML
This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add flex --framework vue or switch the framework in components.json.
<script setup lang="ts">
import { Stack } from "@/components/ui/stack";
const props = withDefaults(
defineProps<{
direction?: "row" | "column";
gap?: "none" | "xs" | "sm" | "md" | "lg" | "xl";
align?: "start" | "center" | "end" | "stretch" | "baseline";
justify?: "start" | "center" | "end" | "between" | "around";
wrap?: boolean;
class?: string;
}>(),
{
direction: "column",
gap: "md",
align: "stretch",
justify: "start",
wrap: false,
},
);
</script>
<template>
<Stack
data-slot="flex"
:direction="props.direction"
:gap="props.gap"
:align="props.align"
:justify="props.justify"
:wrap="props.wrap"
:class="props.class"
>
<slot />
</Stack>
</template>