UNPKG

@base-ui/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.

34 lines (32 loc) 1.06 kB
'use client'; import * as React from 'react'; import { usePopoverRootContext } from "../root/PopoverRootContext.js"; import { useBaseUiId } from "../../internals/useBaseUiId.js"; import { useRenderElement } from "../../internals/useRenderElement.js"; /** * A paragraph with additional information about the popover. * Renders a `<p>` element. * * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover) */ export const PopoverDescription = /*#__PURE__*/React.forwardRef(function PopoverDescription(componentProps, forwardedRef) { const { render, className, style, ...elementProps } = componentProps; const { store } = usePopoverRootContext(); const id = useBaseUiId(elementProps.id); store.useSyncedValueWithCleanup('descriptionElementId', id); const element = useRenderElement('p', componentProps, { ref: forwardedRef, props: [{ id }, elementProps] }); return element; }); if (process.env.NODE_ENV !== "production") PopoverDescription.displayName = "PopoverDescription";