Components
Container
Centers content and constrains its width with responsive gutters.
Installation
$ npx veil-ui@latest add containerUsage
import { Container } from "@/components/ui/container";
<Container size="md">{children}</Container>;Examples
Sizes
max-w-sm
max-w-md
max-w-lg
Page section
Page section
Content is centered with 16px gutters on mobile and 24px above the small breakpoint.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "sm" | "md" | "lg" | "full" | "lg" | Maximum width: 768px, 1024px, 1280px, or unconstrained. |
| ...props | React.ComponentProps<"div"> | — | All native div attributes. |
Accessibility
- Purely presentational. It renders a neutral
<div>, so landmark semantics belong on the surrounding<main>,<section>or<header>. - Gutters are 16px on mobile and 24px from the
smbreakpoint up, keeping text clear of the viewport edge.
Vue and plain HTML
This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add container --framework vue or switch the framework in components.json.
<script setup lang="ts">
import { computed } from "vue";
import { cn } from "@/lib/utils";
import { containerVariants, type ContainerVariants } from "./variants";
const props = withDefaults(
defineProps<{
size?: ContainerVariants["size"];
class?: string;
}>(),
{ size: "lg" },
);
const classes = computed(() =>
cn(containerVariants({ size: props.size }), props.class),
);
</script>
<template>
<div data-slot="container" :data-size="size" :class="classes">
<slot />
</div>
</template>