diff --git a/packages/react/src/popover/root/PopoverRoot.tsx b/packages/react/src/popover/root/PopoverRoot.tsx index d8ca74d9ae..190781098f 100644 --- a/packages/react/src/popover/root/PopoverRoot.tsx +++ b/packages/react/src/popover/root/PopoverRoot.tsx @@ -13,7 +13,7 @@ import { PortalContext } from '../../portal/PortalContext'; * Documentation: [Base UI Popover](https://base-ui.com/react/components/popover) */ const PopoverRoot: React.FC = function PopoverRoot(props) { - const { onOpenChange, openOnHover = false, delay, closeDelay = 0 } = props; + const { defaultOpen, open, onOpenChange, openOnHover = false, delay, closeDelay = 0 } = props; const delayWithDefault = delay ?? OPEN_DELAY; @@ -66,6 +66,13 @@ PopoverRoot.propTypes /* remove-proptypes */ = { * @default 0 */ closeDelay: PropTypes.number, + /** + * Whether the popover is initially open. + * + * To render a controlled popover, use the `open` prop instead. + * @default false + */ + defaultOpen: PropTypes.bool, /** * How long to wait before the popover may be opened on hover. Specified in milliseconds. * @@ -77,6 +84,10 @@ PopoverRoot.propTypes /* remove-proptypes */ = { * Event handler called when the popover is opened or closed. */ onOpenChange: PropTypes.func, + /** + * Whether the popover is currently open. + */ + open: PropTypes.bool, /** * Whether the popover should also open when the trigger is hovered. * @default false diff --git a/packages/react/src/preview-card/root/PreviewCardRoot.tsx b/packages/react/src/preview-card/root/PreviewCardRoot.tsx index c385ee2416..23ca59e2bf 100644 --- a/packages/react/src/preview-card/root/PreviewCardRoot.tsx +++ b/packages/react/src/preview-card/root/PreviewCardRoot.tsx @@ -13,7 +13,7 @@ import { PortalContext } from '../../portal/PortalContext'; * Documentation: [Base UI Preview Card](https://base-ui.com/react/components/preview-card) */ const PreviewCardRoot: React.FC = function PreviewCardRoot(props) { - const { onOpenChange, delay, closeDelay } = props; + const { defaultOpen, open, onOpenChange, delay, closeDelay } = props; const delayWithDefault = delay ?? OPEN_DELAY; const closeDelayWithDefault = closeDelay ?? CLOSE_DELAY; @@ -64,6 +64,13 @@ PreviewCardRoot.propTypes /* remove-proptypes */ = { * @default 300 */ closeDelay: PropTypes.number, + /** + * Whether the preview card is initially open. + * + * To render a controlled preview card, use the `open` prop instead. + * @default false + */ + defaultOpen: PropTypes.bool, /** * How long to wait before the preview card opens. Specified in milliseconds. * @default 600 @@ -73,6 +80,10 @@ PreviewCardRoot.propTypes /* remove-proptypes */ = { * Event handler called when the preview card is opened or closed. */ onOpenChange: PropTypes.func, + /** + * Whether the preview card is currently open. + */ + open: PropTypes.bool, } as any; export { PreviewCardRoot }; diff --git a/packages/react/src/tooltip/root/TooltipRoot.tsx b/packages/react/src/tooltip/root/TooltipRoot.tsx index 670e4c38ff..56c390b495 100644 --- a/packages/react/src/tooltip/root/TooltipRoot.tsx +++ b/packages/react/src/tooltip/root/TooltipRoot.tsx @@ -13,7 +13,15 @@ import { PortalContext } from '../../portal/PortalContext'; * Documentation: [Base UI Tooltip](https://base-ui.com/react/components/tooltip) */ const TooltipRoot: React.FC = function TooltipRoot(props) { - const { onOpenChange, delay, closeDelay, hoverable = true, trackCursorAxis = 'none' } = props; + const { + defaultOpen, + open, + onOpenChange, + delay, + closeDelay, + hoverable = true, + trackCursorAxis = 'none', + } = props; const delayWithDefault = delay ?? OPEN_DELAY; const closeDelayWithDefault = closeDelay ?? 0; @@ -65,6 +73,13 @@ TooltipRoot.propTypes /* remove-proptypes */ = { * @default 0 */ closeDelay: PropTypes.number, + /** + * Whether the tooltip is initially open. + * + * To render a controlled tooltip, use the `open` prop instead. + * @default false + */ + defaultOpen: PropTypes.bool, /** * How long to wait before opening the tooltip. Specified in milliseconds. * @default 600 @@ -79,6 +94,10 @@ TooltipRoot.propTypes /* remove-proptypes */ = { * Event handler called when the tooltip is opened or closed. */ onOpenChange: PropTypes.func, + /** + * Whether the tooltip is currently open. + */ + open: PropTypes.bool, /** * Determines which axis the tooltip should track the cursor on. * @default 'none'