Veil UI
Components

Caption

Small supporting text for images, fields and metadata.

Installation

$ npx veil-ui@latest add caption

Usage

import { Caption } from "@/components/ui/caption";

<Caption>Updated 2 minutes ago</Caption>;

Examples

Basic

Updated 2 minutes ago

With a figure

Dashboard overview after the first sync.

Wrap captions for images in a figcaption so the association is programmatic.

API reference

PropTypeDefaultDescription
tone"default" | "muted""muted"Foreground color tone.

Accessibility

  • Caption text stays at a legible size and inherits the surrounding color contrast.
  • Use it inside figcaption for media, or next to form fields for hints. Avoid relying on it for critical instructions.

Vue and plain HTML

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

<script setup lang="ts">
import { computed } from "vue";

import { cn } from "@/lib/utils";

const props = withDefaults(
  defineProps<{
    tone?: "default" | "muted";
    class?: string;
  }>(),
  { tone: "muted" },
);

const classes = computed(() =>
  cn(
    "text-xs leading-normal",
    props.tone === "muted" ? "text-muted-foreground" : "text-foreground",
    props.class,
  ),
);
</script>

<template>
  <span data-slot="caption" :class="classes">
    <slot />
  </span>
</template>

On this page