Mats Bosson 38ef3b0934 Migrate Dialog to Zod props
Centralises all Dialog prop interfaces and schemas in dialog.props.ts.
Adds DialogRootPropsSchema, DialogContentPropsSchema, and DialogMeta for
AI/MCP discovery. Sub-components now import types from the shared file.
2026-03-29 20:36:18 +07:00

24 lines
763 B
TypeScript

// packages/core/src/components/dialog/dialog-title.tsx
import type { JSX } from "solid-js";
import { createUniqueId, onCleanup, onMount, splitProps } from "solid-js";
import { useInternalDialogContext } from "./dialog-context";
import type { DialogTitleProps } from "./dialog.props";
export type { DialogTitleProps };
/** Renders as h2 and registers its ID for aria-labelledby on Dialog.Content. */
export function DialogTitle(props: DialogTitleProps): JSX.Element {
const [local, rest] = splitProps(props, ["children"]);
const ctx = useInternalDialogContext();
const id = createUniqueId();
onMount(() => ctx.setTitleId(id));
onCleanup(() => ctx.setTitleId(undefined));
return (
<h2 id={id} {...rest}>
{local.children}
</h2>
);
}