import React, { forwardRef } from "react"; import { BodyShort } from "../../../typography"; import { useId } from "../../../utils-external"; import { cl } from "../../../utils/helpers"; import { useBaseAlert } from "../root/BaseAlertRoot.context"; interface BaseAlertTitleProps extends React.HTMLAttributes { children: React.ReactNode; /** * Changes the HTML element used for the title. * @default "h2" */ as?: "h2" | "h3" | "h4" | "h5" | "h6" | "div"; } /** * Title component for BaseAlert. Remember to use correct heading-level with the `as` prop. * @see 🏷️ {@link BaseAlertTitleProps} * @example * ```jsx * * * Info title * * * ``` */ const BaseAlertTitle = forwardRef( ( { children, className, as = "h2", id: idProp, ...restProps }: BaseAlertTitleProps, forwardedRef, ) => { const { size, statusId } = useBaseAlert(); const titleId = useId(idProp); return ( {children} ); }, ); export { BaseAlertTitle }; export type { BaseAlertTitleProps };