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

28 lines
647 B
TypeScript
Raw Normal View History

2026-10-09 18:30:41 +00:00
import type { ReactNode } from "react";
import { useId } from "react";
import { FormSectionTitle } from "./form-section-title";
2026-10-09 18:30:41 +00:00
/** 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"}
>
<FormSectionTitle id={id}>{title}</FormSectionTitle>
2026-10-09 18:30:41 +00:00
{children}
</section>
);
}