UNPKG

@base-ui-components/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

38 lines (37 loc) 1.3 kB
"use strict"; 'use client'; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default; Object.defineProperty(exports, "__esModule", { value: true }); exports.AlertDialogTitle = void 0; var React = _interopRequireWildcard(require("react")); var _DialogRootContext = require("../../dialog/root/DialogRootContext"); var _useRenderElement = require("../../utils/useRenderElement"); var _useBaseUiId = require("../../utils/useBaseUiId"); /** * A heading that labels the dialog. * Renders an `<h2>` element. * * Documentation: [Base UI Alert Dialog](https://base-ui.com/react/components/alert-dialog) */ const AlertDialogTitle = exports.AlertDialogTitle = /*#__PURE__*/React.forwardRef(function AlertDialogTitle(componentProps, forwardedRef) { const { render, className, id: idProp, ...elementProps } = componentProps; const { store } = (0, _DialogRootContext.useDialogRootContext)(); const id = (0, _useBaseUiId.useBaseUiId)(idProp); store.useSyncedValueWithCleanup('titleElementId', id); return (0, _useRenderElement.useRenderElement)('h2', componentProps, { ref: forwardedRef, props: [{ id }, elementProps] }); }); if (process.env.NODE_ENV !== "production") AlertDialogTitle.displayName = "AlertDialogTitle";