Floating elements use Floating UI under the hood. To this end, we expose a floatingConfig option, which can be used to control the underlying computePosition function, its middlewares, and the resulting styling that is applied.
API Reference
Constructor Props
The props that are passed when calling
newPopover()
newPopover()
exporttypePopoverProps={
/**
* If the Popover is open.
*
* When passing a getter, it will be used as source of truth,
* meaning that the value only changes when the getter returns a new value.
*
* Otherwise, if passing a static value, it'll serve as the default value.
*
*
* @defaultfalse
*/
open?:MaybeGetter<boolean|undefined>;
/**
* Called when the value is supposed to change.
*/
onOpenChange?:(value:boolean)=>void;
/**
* If the popover visibility should be controlled by the user.
*
* @defaultfalse
*/
forceVisible?:MaybeGetter<boolean|undefined>;
/**
* Config to be passed to `useFloating`
*/
floatingConfig?:UseFloatingArgs["config"];
/**
* If the popover should have the same width as the trigger
*
* @defaultfalse
*/
sameWidth?:MaybeGetter<boolean|undefined>;
/**
* If the popover should close when clicking escape.
*
* @defaulttrue
*/
closeOnEscape?:MaybeGetter<boolean|undefined>;
/**
* If the popover should close when clicking outside.
* Alternatively, accepts a function that receives the clicked element,
* and returns if the popover should close.
*
* @defaulttrue
*/
closeOnOutsideClick?:CloseOnOutsideClickProp;
};
exporttypePopoverProps={
/**
* If the Popover is open.
*
* When passing a getter, it will be used as source of truth,
* meaning that the value only changes when the getter returns a new value.
*
* Otherwise, if passing a static value, it'll serve as the default value.
*
*
* @defaultfalse
*/
open?:MaybeGetter<boolean|undefined>;
/**
* Called when the value is supposed to change.
*/
onOpenChange?:(value:boolean)=>void;
/**
* If the popover visibility should be controlled by the user.
*
* @defaultfalse
*/
forceVisible?:MaybeGetter<boolean|undefined>;
/**
* Config to be passed to `useFloating`
*/
floatingConfig?:UseFloatingArgs["config"];
/**
* If the popover should have the same width as the trigger
*
* @defaultfalse
*/
sameWidth?:MaybeGetter<boolean|undefined>;
/**
* If the popover should close when clicking escape.
*
* @defaulttrue
*/
closeOnEscape?:MaybeGetter<boolean|undefined>;
/**
* If the popover should close when clicking outside.
* Alternatively, accepts a function that receives the clicked element,