Veil UI
Components

Form Actions

Aligns the submit and cancel buttons at the end of a form.

Installation

$ npx veil-ui@latest add form-actions

Usage

import { FormActions } from "@/components/ui/form-actions";

<FormActions>
  <Button variant="outline">Cancel</Button>
  <Button type="submit">Save</Button>
</FormActions>;

Examples

Basic

Split

With hint

Changes apply to every environment.

API reference

PropTypeDefaultDescription
align"start" | "center" | "end" | "between""end"Distribution of the actions along the row.
...propsReact.ComponentProps<"div">—All native div attributes.

Accessibility

  • Renders a plain container; the buttons keep their native semantics.
  • Make the primary action the last button in DOM order so keyboard focus reaches the safe choice before the destructive one.
  • Wrap on small viewports instead of shrinking the buttons below 32px.

Vue and plain HTML

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

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

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

import { alignments, type FormActionsAlign } from "./types";

const props = withDefaults(
  defineProps<{ class?: string; align?: FormActionsAlign }>(),
  { align: "end" },
);

const classes = computed(() =>
  cn(
    "flex flex-wrap items-center gap-2 border-t pt-4",
    alignments[props.align],
    props.class,
  ),
);
</script>

<template>
  <div data-slot="form-actions" :data-align="align" :class="classes">
    <slot />
  </div>
</template>

On this page