Veil UI
Components

HStack

A horizontal Stack preset with centered items by default.

Installation

$ npx veil-ui@latest add hstack

Usage

import { HStack } from "@/components/ui/hstack";

<HStack gap="sm">
  <Badge>React</Badge>
  <Badge>Tailwind</Badge>
</HStack>;

Examples

Basic

ReactTailwindRadix UI

Toolbar

Filters

Wrapping

designdocsregistrytokensclia11y

API reference

HStack forwards every Stack prop except direction, which is fixed to row. Defaults: gap="md", align="center" and justify="start".

PropTypeDefaultDescription
gap"none" | "xs" | "sm" | "md" | "lg" | "xl""md"Space between children.
align"start" | "center" | "end" | "stretch" | "baseline""center"Cross-axis alignment.
justify"start" | "center" | "end" | "between" | "around""start"Main-axis distribution.
wrapbooleanfalseAllow children to wrap onto multiple lines.
...propsReact.ComponentProps<"div">—All native div attributes.

Accessibility

  • Presentational flex wrapper; it adds no ARIA roles.
  • It renders the shared stack source, so install it together with stack.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add hstack --framework vue or switch the framework in components.json.

<script setup lang="ts">
import { Stack } from "@/components/ui/stack";

const props = withDefaults(
  defineProps<{
    gap?: "none" | "xs" | "sm" | "md" | "lg" | "xl";
    align?: "start" | "center" | "end" | "stretch" | "baseline";
    justify?: "start" | "center" | "end" | "between" | "around";
    wrap?: boolean;
    class?: string;
  }>(),
  {
    gap: "md",
    align: "center",
    justify: "start",
    wrap: false,
  },
);
</script>

<template>
  <Stack
    data-slot="h-stack"
    direction="row"
    :gap="props.gap"
    :align="props.align"
    :justify="props.justify"
    :wrap="props.wrap"
    :class="props.class"
  >
    <slot />
  </Stack>
</template>

On this page