import type { JSX, ValidComponent } from "@solidjs/web"; /** * `` — heading that labels the dialog. */ import { dynamic } from "@solidjs/web"; import { omit, untrack } from "solid-js"; import { mergeRootProps } from "../../internals/merge-root-props"; import { resolveClassStyle } from "../../internals/resolve-class-style"; import type { BaseUIComponentProps } from "../../internals/types"; import { useRegisteredLabelId } from "../../internals/use-registered-label-id"; import { useDialogRootContext } from "../dialog-root-context"; // biome-ignore lint/complexity/noBannedTypes: matches Base UI React — title exposes no state fields. export type DialogTitleState = {}; export interface DialogTitleProps extends BaseUIComponentProps< "h1" | "h2" | "h3" | "h4" | "h5" | "h6", DialogTitleState > { /** * Tag/component to render. Defaults to `"h2"`. Replaces the * pre-spike `render` prop (axis G). */ as?: ValidComponent; } /** * A heading that labels the dialog. Renders an `

` by default. */ export function DialogTitle(props: DialogTitleProps): JSX.Element { const root = useDialogRootContext(); // `props.id` is an id override read once at setup; untrack it so the read // doesn't trip STRICT_READ_UNTRACKED (same fix as ). const id = useRegisteredLabelId( untrack(() => props.id as string | undefined), root.setTitleId, ); const internal = { id, }; const userClassStyle = resolveClassStyle(props, () => ({})); const userProps = omit(props, "as", "class", "style", "attrs"); let merged: Record = mergeRootProps( internal, userClassStyle, ); merged = mergeRootProps(merged, userProps); const Tag = dynamic(() => props.as ?? "h2"); return ; }