# FieldSet Variants (cva config) ## Purpose `fieldSetVariants` and `fieldLegendVariants` are the cva (class-variance-authority) configurations powering `
` and ``. They are split from `field-set.tsx` into their own module so an ejected source copy keeps the cva configurations in a dedicated file. Theme overrides flow through `useThemedVariants("FieldSet" | "FieldLegend")`. These cvas are part of the suaveplan-only `
` addition (no shadcn upstream) — see `field-set.md` for the rationale. ## Features - `
` carries `flex flex-col gap-3 rounded-md border p-4` so the grouping is visually obvious. - `data-[disabled=true]:opacity-70` decay when disabled. - `` is small bold text (`text-sm font-semibold`) with `data-[invalid=true]:text-destructive` for the error state. - NEVER uses `space-y-*` per the shadcn skill rule. ## Usage: Basic Example ```ts import { fieldSetVariants, fieldLegendVariants } from "@suaveplan/react-ui"; const fsClass = fieldSetVariants(); const lgClass = fieldLegendVariants(); ``` ## Usage: Advanced Example ```ts import { fieldSetVariants, cn } from "@suaveplan/react-ui"; export function CustomFieldSet({ children, }: { children: React.ReactNode; }) { return (
{children}
); } ``` ## API Reference ### `fieldSetVariants(): string` Returns the fieldset classes. ### `fieldLegendVariants(): string` Returns the legend classes including the `data-[invalid=true]:text-destructive` selector. ## Implementation Notes - The `
` border + padding are intentionally part of the cva default — most `
` use cases want the visual grouping. Consumers wanting an unstyled fieldset pass `className="border-0 p-0"` (Tailwind class merging via `tailwind-merge` resolves the conflict). - The legend's destructive colour is keyed off `data-[invalid=true]` directly rather than via a group selector so the legend can be used outside a `
` without losing the error styling. - Per the shadcn skill rule, the cva NEVER uses `space-y-*` — `gap-3` flows the same in RTL.