metis-desk/packages/rdx-ui/src/components/form-section.tsx

35 lines
772 B
TypeScript
Raw Normal View History

2026-10-09 18:30:41 +00:00
import type { ReactNode } from "react";
import { useId } from "react";
/** Bloque visual reutilizable con título accesible; no altera validación ni datos. */
export function FormSection({
title,
children,
variant = "card",
}: {
title: string;
children: ReactNode;
variant?: "card" | "plain";
}) {
2026-10-09 18:30:41 +00:00
const id = useId();
2026-10-10 10:01:58 +00:00
2026-10-09 18:30:41 +00:00
return (
<section
aria-labelledby={id}
className={variant === "plain" ? "@container space-y-3" : "space-y-4 rounded-lg border p-4"}
>
<h3
className={
variant === "plain"
? "text-xs font-medium uppercase tracking-wide text-muted-foreground"
: "text-sm font-semibold"
}
id={id}
>
2026-10-09 18:30:41 +00:00
{title}
</h3>
{children}
</section>
);
}