import React, { forwardRef } from "react"; import { Heading } from "../../typography"; import { useClientLayoutEffect, useId } from "../../utils-external"; import { cl } from "../../utils/helpers"; import { useDialogContext } from "../root/DialogRoot.context"; type DialogTitleProps = React.HTMLAttributes; /** * @see 🏷️ {@link DialogTitleProps} * @example * ```jsx * * * * Dialog title * * * * ``` */ const DialogTitle = forwardRef( ({ className, children, id, ...restProps }, forwardedRef) => { const { size, setTitleId } = useDialogContext(); const titleId = useId(id); useClientLayoutEffect(() => { setTitleId(titleId); return () => { setTitleId(undefined); }; }, [titleId, setTitleId]); return ( {children} ); }, ); export { DialogTitle }; export type { DialogTitleProps };