Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
971b6f9
Shared referenceProps
michaldudak Jul 17, 2025
fc2138c
Update Floating UI to work with multiple triggers
michaldudak Jul 21, 2025
3a56526
Create a working demo
michaldudak Jul 21, 2025
6d6d22a
Do not animate initial appearance
michaldudak Jul 21, 2025
d9152e6
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Jul 21, 2025
4088d34
Suppress TS error
michaldudak Jul 21, 2025
f65cc32
Cleanup
michaldudak Jul 21, 2025
bfee582
Open on hover setting
michaldudak Jul 21, 2025
d9d1905
Remove unnecessary data prop
michaldudak Jul 21, 2025
7a4f3bf
Animate popups' dimensions
michaldudak Jul 22, 2025
6740f73
Fix autoresize
michaldudak Jul 23, 2025
3b03622
Update Popover implementation to use the Store
michaldudak Jul 23, 2025
6543ba0
Fix hover triggers
michaldudak Jul 23, 2025
b0de7c8
Remove unnecessary props
michaldudak Jul 23, 2025
d8ee5ac
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Jul 24, 2025
e6c5e96
Fix height transitions when anchored on top
michaldudak Jul 25, 2025
4a45232
Remove separate DetachedTriggerComponent
michaldudak Jul 25, 2025
6531171
Fix some of the issues
michaldudak Jul 25, 2025
b46d7fe
Update the experiment
michaldudak Jul 28, 2025
a1a8eee
Cleanup
michaldudak Jul 28, 2025
a8a6656
Payload type safety
michaldudak Jul 29, 2025
4b3fd46
Fix `stickIfOpen`
michaldudak Jul 29, 2025
ee73f22
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Jul 29, 2025
c10b27f
API docs
michaldudak Jul 29, 2025
80f56d3
Fix build errors
michaldudak Jul 29, 2025
c7eb92a
Fix modality, set initial state
michaldudak Jul 29, 2025
3bc5d73
Update tests
michaldudak Jul 29, 2025
4d0a555
Controlled mode WIP
michaldudak Jul 30, 2025
03f81f8
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Jul 30, 2025
1a55d07
lint, api docs
michaldudak Jul 30, 2025
4498f3b
dedupe
michaldudak Jul 30, 2025
bd331f4
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Jul 30, 2025
fd17f93
Fix controlled mode
michaldudak Jul 31, 2025
f10279d
Make a Trigger mandatory
michaldudak Jul 31, 2025
b58ea65
Change onOpenChange signature
michaldudak Jul 31, 2025
0205efc
docs:api
michaldudak Jul 31, 2025
323ca10
comment
michaldudak Jul 31, 2025
ef7084d
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Jul 31, 2025
7d99d16
dedupe
michaldudak Jul 31, 2025
fff7da9
Fix controlled popups not appearing
michaldudak Jul 31, 2025
2d84030
Update demos
michaldudak Jul 31, 2025
5bbcc7e
Set open state only for active triggers
michaldudak Aug 1, 2025
cc26415
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Aug 1, 2025
a3e3a26
Correct a11y attributes for inactive triggers
michaldudak Aug 1, 2025
d09bd98
Recreate lockfile
michaldudak Aug 1, 2025
dc4822b
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Aug 12, 2025
b41b0e8
Remove gaps between triggers
michaldudak Aug 12, 2025
1e9dc60
Support transitions while hovering
michaldudak Aug 13, 2025
c8e98bf
Somewhat working content transitions
michaldudak Aug 13, 2025
63d00b0
Fix
michaldudak Aug 14, 2025
87fcc2f
Fix opening the wrong popover on hover with delay
michaldudak Aug 14, 2025
50ceda6
TransitionContainer -> Viewport
michaldudak Aug 14, 2025
c6de7d2
API docs
michaldudak Aug 14, 2025
682766b
Restore closeOnFocusOut
michaldudak Aug 14, 2025
482a2b3
Hint what component should stay stable
michaldudak Aug 14, 2025
4261b0b
Recreate the old content using innerHTML instead of JSX tree
michaldudak Aug 14, 2025
8e467f0
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Aug 19, 2025
e7f5357
Docs and demos
michaldudak Aug 19, 2025
6a9bc64
Fix a mistake in the example
michaldudak Aug 19, 2025
94f35e8
Fix docs
michaldudak Aug 19, 2025
4cd22af
JSDocs, cleanup, fixes
michaldudak Aug 20, 2025
b5672eb
Add tests
michaldudak Aug 20, 2025
f5a8901
Fix tests
michaldudak Aug 20, 2025
f91b5bf
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Aug 20, 2025
ef0bf76
Do not run tests on JSDOM
michaldudak Aug 20, 2025
7610fde
Do not show shared state in experiments
michaldudak Aug 20, 2025
4637d11
Do not include demo files without default export in regression tests
michaldudak Aug 20, 2025
027c64d
Cleanup
michaldudak Aug 20, 2025
176e2fc
Do not modify old trigger maps
michaldudak Aug 21, 2025
6d8627a
Detect aborted animations
michaldudak Aug 21, 2025
f347f42
Remove unnecessary positionerRef
michaldudak Aug 21, 2025
48c0615
Revert
michaldudak Aug 21, 2025
8234bec
Fix layout shifting during content transitions
michaldudak Aug 25, 2025
3440cb1
Prettier
michaldudak Aug 25, 2025
d482c8a
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Aug 25, 2025
2fa33ac
Do not use `innerHTML`/`dangerouslySetInnerHTML`
michaldudak Aug 25, 2025
56e59c5
Fix ref cleanup
michaldudak Aug 25, 2025
25062e3
Keep the `open` prop a boolean and add the `triggerId` prop
michaldudak Aug 26, 2025
dba3a53
Add close to imperative actions
michaldudak Aug 26, 2025
feb1f03
Fix TS and API docs
michaldudak Aug 26, 2025
89bc14a
Dedupe
michaldudak Aug 26, 2025
26f4079
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Aug 27, 2025
25b7191
Recreate the lockfile
michaldudak Aug 27, 2025
d468eab
Fix disappearing arrow
michaldudak Aug 27, 2025
ff5b413
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Aug 27, 2025
69197a5
API docs
michaldudak Aug 27, 2025
64c6f82
Merge eventDetails and options parameters
michaldudak Aug 27, 2025
37c2423
Fix hover with delay=0
michaldudak Aug 28, 2025
6791a00
Fix controlled input warning
michaldudak Aug 28, 2025
f58b76e
Viewport tests
michaldudak Aug 28, 2025
bc9a03f
Tailwind demos
michaldudak Aug 28, 2025
449eebf
Fix `inert` value on R18
michaldudak Aug 28, 2025
246dd66
Refactor usePreviousRenderValue
michaldudak Aug 28, 2025
47c4c82
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Sep 8, 2025
576421c
Add missing paren
michaldudak Sep 8, 2025
21748a0
Update demos and docs
michaldudak Sep 8, 2025
e858dbe
Pass trigger to onOpenChange
michaldudak Sep 8, 2025
551ff08
Update `useFloating` to recognize triggers
michaldudak Sep 9, 2025
0bbe272
Make transitions consistent
michaldudak Sep 9, 2025
5b07b1a
dedupe
michaldudak Sep 9, 2025
51acf6b
Improve the fully featured demo
michaldudak Sep 9, 2025
821fae6
prettier
michaldudak Sep 9, 2025
2473531
Use state in `usePreviousRenderValue`
michaldudak Sep 9, 2025
48366c9
Tests and cleanup
michaldudak Sep 9, 2025
f7a8579
Transition improvements
michaldudak Sep 10, 2025
46264ca
Almost there
michaldudak Sep 10, 2025
fff09c6
fix WIP
michaldudak Sep 12, 2025
f642d11
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Sep 15, 2025
f9a8f8b
Fix size calculations
michaldudak Sep 15, 2025
a95e936
Remove debug code
michaldudak Sep 15, 2025
6cfc0af
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Sep 15, 2025
d3c18b2
Fix sizing issue and update Tailwind demo
michaldudak Sep 15, 2025
404b6c0
Inline demo icons
michaldudak Sep 16, 2025
c5a4b89
Update the docs
michaldudak Sep 16, 2025
b148fb8
Fix animation restarting when toggling the open state repeatedly
michaldudak Sep 16, 2025
23cdb6c
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Sep 16, 2025
ae9e720
Fix layout glitch
michaldudak Sep 16, 2025
64948de
Docs
michaldudak Sep 17, 2025
a4c1607
Revert useStoreControlled
michaldudak Sep 17, 2025
7f0b948
contains
michaldudak Sep 17, 2025
b49358f
Add trigger to BaseUIEventDetails
michaldudak Sep 17, 2025
9048abd
Remove `innerHTML`
michaldudak Sep 17, 2025
bdec6fe
Fix NavigationMenu regression
michaldudak Sep 17, 2025
b4da865
Fix layout shift when closing the popover during content transitions
michaldudak Sep 18, 2025
b69104a
Fix tests
michaldudak Sep 18, 2025
2013b72
dedupe
michaldudak Sep 18, 2025
483c10e
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Sep 18, 2025
b3172e9
Fix focus management
michaldudak Sep 19, 2025
6eb6cdb
Fixes
michaldudak Sep 19, 2025
c6e9a58
Fix focus restoration on esc
michaldudak Sep 19, 2025
cbe8e11
Do not close the popup on shift+tab
michaldudak Sep 19, 2025
d1f4520
Cleanup
michaldudak Sep 19, 2025
60522c0
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Sep 19, 2025
41178e4
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Sep 22, 2025
ee0a1be
Focus issues
michaldudak Sep 22, 2025
c089f6a
More focus fixes
michaldudak Sep 22, 2025
6f04c99
Fixing R18 tests
michaldudak Sep 22, 2025
2affba5
Fix the `key` spread issue
michaldudak Sep 23, 2025
16354d2
Formatting
michaldudak Sep 23, 2025
c414231
Testing leftover
michaldudak Sep 23, 2025
54e0297
Use `resolveRef` elsewhere
michaldudak Sep 23, 2025
ac67488
Fix
michaldudak Sep 23, 2025
5385539
Set data-instant on focusout
michaldudak Sep 23, 2025
b8f2769
Fix iOS size calculation
michaldudak Sep 23, 2025
846b34b
Capitalize titles
michaldudak Sep 23, 2025
fe45dea
Typo
michaldudak Sep 23, 2025
b1b2983
Controlled mode docs and demo
michaldudak Sep 23, 2025
f7a7d26
Use CSS transitions in the demo
michaldudak Sep 24, 2025
cc6ffe8
API docs
michaldudak Sep 24, 2025
a5f4cb6
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Sep 24, 2025
379ac3a
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Sep 29, 2025
556dc6a
Use new methods from the ReactStore
michaldudak Sep 29, 2025
946eb93
Use `store.useControlledProp`
michaldudak Sep 30, 2025
a547bec
Add Calendar experiment
michaldudak Oct 2, 2025
0901f32
Ignore available width/height when measuring popup size
michaldudak Oct 2, 2025
a851cb0
Remove starting-style when measuring content
michaldudak Oct 2, 2025
6d16361
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Oct 2, 2025
9609029
Lint, dedupe
michaldudak Oct 3, 2025
c5e58c4
API docs
michaldudak Oct 3, 2025
d59a259
Fix exploding layout in controlled demo
michaldudak Oct 3, 2025
aa2d8f5
Revert ignoring starting style
michaldudak Oct 3, 2025
610eb03
Fix transition issue in the deployed docs
michaldudak Oct 3, 2025
800730b
Fixing React 18
michaldudak Oct 5, 2025
a8c54a7
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Oct 5, 2025
edf8d4e
Dedupe
michaldudak Oct 5, 2025
9f594cf
Remove redundant ref
michaldudak Oct 5, 2025
0027f01
Move refs to store's context
michaldudak Oct 6, 2025
bf7a6b6
Merge remote-tracking branch 'upstream/master' into popover-detached-…
michaldudak Oct 6, 2025
7529cc3
Experiment updates
michaldudak Oct 6, 2025
15109b5
Cleanup
michaldudak Oct 6, 2025
feb8909
Prettier
michaldudak Oct 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"hast": "^1.0.0",
"hast-util-heading-rank": "^3.0.0",
"hast-util-to-string": "^3.0.1",
"lucide-react": "^0.544.0",
"lz-string": "^1.5.0",
"match-sorter": "^8.1.0",
"next": "15.5.3",
Expand Down
9 changes: 8 additions & 1 deletion docs/reference/generated/popover-popup.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,12 @@
"description": "Present when the popup is animating out."
}
},
"cssVariables": {}
"cssVariables": {
"--popup-height": {
"description": "The height of the popup."
},
"--popup-width": {
"description": "The width of the popup."
}
}
}
6 changes: 6 additions & 0 deletions docs/reference/generated/popover-positioner.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@
"description": "The available width between the trigger and the edge of the viewport.",
"type": "number"
},
"--positioner-height": {
"description": "The height of the popover's positioner.\nIt is important to set `height` to this value when using CSS to animate size changes."
},
"--positioner-width": {
"description": "The width of the popover's positioner.\nIt is important to set `width` to this value when using CSS to animate size changes."
},
"--transform-origin": {
"description": "The coordinates that this element is anchored to. Used for animations and transitions.",
"type": "string"
Expand Down
43 changes: 20 additions & 23 deletions docs/reference/generated/popover-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"props": {
"defaultOpen": {
"type": "boolean",
"default": "false",
"description": "Whether the popover is initially open.\n\nTo render a controlled popover, use the `open` prop instead.",
"description": "Whether the popover is initially open.\nTo render a controlled popover, use the `open` prop instead.",
"detailedType": "boolean | undefined"
},
"open": {
Expand All @@ -19,9 +18,19 @@
"detailedType": "| ((\n open: boolean,\n eventDetails: Popover.Root.ChangeEventDetails,\n ) => void)\n| undefined"
},
"actionsRef": {
"type": "RefObject<Popover.Root.Actions>",
"type": "RefObject<Popover.Root.Actions | null>",
"description": "A ref to imperative actions.\n- `unmount`: When specified, the popover will not be unmounted when closed.\nInstead, the `unmount` function must be called to unmount the popover manually.\nUseful when the popover's animation is controlled by an external library.",
"detailedType": "React.RefObject<Popover.Root.Actions> | undefined"
"detailedType": "| React.RefObject<Popover.Root.Actions | null>\n| undefined"
},
"defaultTriggerId": {
"type": "string | null",
"description": "ID of the trigger that the popover is associated with.\nThis is useful in conjuntion with the `defaultOpen` prop to create an initially open popover.",
"detailedType": "string | null | undefined"
},
"handle": {
"type": "PopoverStore<Payload>",
"description": "A handle to associate the popover with a trigger.\nIf specified, allows external triggers to control the popover's open state.",
"detailedType": "{} | undefined"
},
"modal": {
"type": "boolean | 'trap-focus'",
Expand All @@ -34,27 +43,15 @@
"description": "Event handler called after any animations complete when the popover is opened or closed.",
"detailedType": "((open: boolean) => void) | undefined"
},
"openOnHover": {
"type": "boolean",
"default": "false",
"description": "Whether the popover should also open when the trigger is hovered.",
"detailedType": "boolean | undefined"
},
"delay": {
"type": "number",
"default": "300",
"description": "How long to wait before the popover may be opened on hover. Specified in milliseconds.\n\nRequires the `openOnHover` prop.",
"detailedType": "number | undefined"
},
"closeDelay": {
"type": "number",
"default": "0",
"description": "How long to wait before closing the popover that was opened on hover.\nSpecified in milliseconds.\n\nRequires the `openOnHover` prop.",
"detailedType": "number | undefined"
"triggerId": {
"type": "string | null",
"description": "ID of the trigger that the popover is associated with.\nThis is useful in conjuntion with the `open` prop to create a controlled popover.\nThere's no need to specify this prop when the popover is uncontrolled (i.e. when the `open` prop is not set).",
"detailedType": "string | null | undefined"
},
"children": {
"type": "ReactNode",
"detailedType": "React.ReactNode"
"type": "ReactNode | Popover.Root.ChildRenderFunction<Payload>",
"description": "The content of the popover.\nThis can be a regular React node or a render function that receives the `payload` of the active trigger.",
"detailedType": "| React.ReactNode\n| ((arg: { payload: Payload | undefined }) => ReactNode)"
}
},
"dataAttributes": {},
Expand Down
33 changes: 33 additions & 0 deletions docs/reference/generated/popover-trigger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,45 @@
"name": "PopoverTrigger",
"description": "A button that opens the popover.\nRenders a `<button>` element.",
"props": {
"handle": {
"type": "PopoverStore<Payload>",
"description": "A handle to associate the trigger with a popover.",
"detailedType": "{} | undefined"
},
"nativeButton": {
"type": "boolean",
"default": "true",
"description": "Whether the component renders a native `<button>` element when replacing it\nvia the `render` prop.\nSet to `false` if the rendered element is not a button (e.g. `<div>`).",
"detailedType": "boolean | undefined"
},
"payload": {
"type": "Payload",
"description": "A payload to pass to the popover when it is opened.",
"detailedType": "Payload | undefined"
},
"openOnHover": {
"type": "boolean",
"default": "false",
"description": "Whether the popover should also open when the trigger is hovered.",
"detailedType": "boolean | undefined"
},
"delay": {
"type": "number",
"default": "300",
"description": "How long to wait before the popover may be opened on hover. Specified in milliseconds.\n\nRequires the `openOnHover` prop.",
"detailedType": "number | undefined"
},
"closeDelay": {
"type": "number",
"default": "0",
"description": "How long to wait before closing the popover that was opened on hover.\nSpecified in milliseconds.\n\nRequires the `openOnHover` prop.",
"detailedType": "number | undefined"
},
"id": {
"type": "string",
"description": "Id of the trigger. In addition to being forwarded to the rendered element,\nit is also used to specify the active trigger for the popover in controlled mode (with the PopoverRoot `triggerId` prop).",
"detailedType": "string | undefined"
},
"className": {
"type": "string | ((state: Popover.Trigger.State) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
Expand Down
44 changes: 44 additions & 0 deletions docs/reference/generated/popover-viewport.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "PopoverViewport",
"description": "A viewport for displaying content transitions.\nThis component is only required if one popup can be opened by multiple triggers, its content change based on the trigger\nand switching between them is animated.\nRenders a `<div>` element.",
"props": {
"children": {
"type": "ReactNode",
"description": "The content to render inside the transition container.",
"detailedType": "React.ReactNode"
},
"className": {
"type": "string | ((state: Popover.Viewport.State) => string)",
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state.",
"detailedType": "| string\n| ((state: Popover.Viewport.State) => string)"
},
"render": {
"type": "ReactElement | ((props: HTMLProps, state: Popover.Viewport.State) => ReactElement)",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render.",
"detailedType": "| ReactElement\n| ((\n props: HTMLProps,\n state: Popover.Viewport.State,\n ) => ReactElement)"
}
},
"dataAttributes": {
"data-activation-direction": {
"description": "Indicates the direction from which the popup was activated.\nThis can be used to create directional animations based on how the popup was triggered.\nContains space-separated values for both horizontal and vertical axes.",
"type": "`${'left' | 'right'} {'top' | 'bottom'}`"
},
"data-current": {
"description": "Applied to the direct child of the viewport when no transitions are present or the new content when it's entering."
},
"data-previous": {
"description": "Applied to the direct child of the viewport that contains the exiting content when transitions are present."
},
"data-transitioning": {
"description": "Indicates that the viewport is currently transitioning between old and new content."
}
},
"cssVariables": {
"--popup-height": {
"description": "The height of the parent popup.\nThis variable is placed on the 'previous' container and stores the height of the popup when the previous content was rendered.\nIt can be used to freeze the dimensions of the popup when animating between different content."
},
"--popup-width": {
"description": "The width of the parent popup.\nThis variable is placed on the 'previous' container and stores the width of the popup when the previous content was rendered.\nIt can be used to freeze the dimensions of the popup when animating between different content."
}
}
}
4 changes: 2 additions & 2 deletions docs/reference/generated/slider-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"detailedType": "number | number[] | undefined"
},
"onValueChange": {
"type": "((value: number | number[], eventDetails: { reason: 'none', event: ReasonToEvent, cancel: (() => void), allowPropagation: (() => void), isCanceled: boolean, isPropagationAllowed: boolean } & { activeThumbIndex: number }) => void)",
"type": "((value: number | number[], eventDetails: { reason: 'none', event: ReasonToEvent, cancel: (() => void), allowPropagation: (() => void), isCanceled: boolean, isPropagationAllowed: boolean, trigger: HTMLElement | undefined } & { activeThumbIndex: number }) => void)",
"description": "Callback function that is fired when the slider's value changed.\nYou can pull out the new value by accessing `event.target.value` (any).",
"detailedType": "| ((\n value: number | number[],\n eventDetails: {\n reason: 'none'\n event: ReasonToEvent\n cancel: () => void\n allowPropagation: () => void\n isCanceled: boolean\n isPropagationAllowed: boolean\n } & { activeThumbIndex: number },\n ) => void)\n| undefined"
"detailedType": "| ((\n value: number | number[],\n eventDetails: {\n reason: 'none'\n event: ReasonToEvent\n cancel: () => void\n allowPropagation: () => void\n isCanceled: boolean\n isPropagationAllowed: boolean\n trigger: HTMLElement | undefined\n } & { activeThumbIndex: number },\n ) => void)\n| undefined"
},
"onValueCommitted": {
"type": "((value: number | number[], eventDetails: Slider.Root.CommitEventDetails) => void)",
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generated/tabs-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"description": "The value of the currently selected `Tab`. Use when the component is controlled.\nWhen the value is `null`, no Tab will be selected."
},
"onValueChange": {
"type": "((value: Tabs.Tab.Value, eventDetails: { reason: 'none', event: ReasonToEvent, cancel: (() => void), allowPropagation: (() => void), isCanceled: boolean, isPropagationAllowed: boolean } & { activationDirection: Tabs.Tab.ActivationDirection }) => void)",
"type": "((value: Tabs.Tab.Value, eventDetails: { reason: 'none', event: ReasonToEvent, cancel: (() => void), allowPropagation: (() => void), isCanceled: boolean, isPropagationAllowed: boolean, trigger: HTMLElement | undefined } & { activationDirection: Tabs.Tab.ActivationDirection }) => void)",
"description": "Callback invoked when new value is being set.",
"detailedType": "| ((\n value: Tabs.Tab.Value,\n eventDetails: {\n reason: 'none'\n event: ReasonToEvent\n cancel: () => void\n allowPropagation: () => void\n isCanceled: boolean\n isPropagationAllowed: boolean\n } & {\n activationDirection: Tabs.Tab.ActivationDirection\n },\n ) => void)\n| undefined"
"detailedType": "| ((\n value: Tabs.Tab.Value,\n eventDetails: {\n reason: 'none'\n event: ReasonToEvent\n cancel: () => void\n allowPropagation: () => void\n isCanceled: boolean\n isPropagationAllowed: boolean\n trigger: HTMLElement | undefined\n } & {\n activationDirection: Tabs.Tab.ActivationDirection\n },\n ) => void)\n| undefined"
},
"orientation": {
"type": "Tabs.Root.Orientation",
Expand Down
11 changes: 9 additions & 2 deletions docs/src/app/(private)/experiments/motion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ function AlwaysMounted() {

function NoOpacity() {
const [open, setOpen] = React.useState(false);
const actionsRef = React.useRef<Popover.Root.Actions>({ unmount: () => {} });
const actionsRef = React.useRef<Popover.Root.Actions>({ unmount: () => {}, close: () => {} });

return (
<Popover.Root open={open} onOpenChange={setOpen} actionsRef={actionsRef}>
<Popover.Root
open={open}
onOpenChange={(nextOpen, eventDetails) => {
setOpen(nextOpen);
eventDetails.preventUnmountOnClose();
}}
actionsRef={actionsRef}
Comment on lines +66 to +71
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this special method a bit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously unmounting was prevented whenever actionsRef was present. As I added a new imperative action, this logic didn't make sense anymore, so I had to make preventing unmounting explicit.

>
<Popover.Trigger>Trigger</Popover.Trigger>
<AnimatePresence>
{open && (
Expand Down
15 changes: 15 additions & 0 deletions docs/src/app/(private)/experiments/popover/calendar-shared.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Popover } from '@base-ui-components/react/popover';

export const eventPopover = Popover.createHandle<EventData>();

export interface EventData {
title: string;
dayOfWeek: number;
dateString: string;
description?: string;
location?: string;
imageUrl?: string;
startTime: number;
endTime: number;
id: number;
}
Loading
Loading