npx gluestack-ui add popoverimport {
Popover,
PopoverBackdrop,
PopoverContent,
PopoverArrow,
PopoverHeader,
PopoverCloseButton,
PopoverBody,
PopoverFooter,
} from '@/components/ui/popover';
export default () => (
<Popover>
<PopoverBackdrop />
<PopoverContent>
<PopoverArrow />
<PopoverHeader>
<PopoverCloseButton />
</PopoverHeader>
<PopoverBody />
<PopoverFooter />
</PopoverContent>
</Popover>
);
| Prop | Type | Default | Description |
|---|---|---|---|
defaultIsOpen | boolean | - | Specifies the default open state of the popover. |
isOpen | boolean | - | If true, the popover will open. Useful for controllable state behavior. |
trapFocus | boolean | true | Whether popover should trap focus. |
focusScope | boolean | true | Whether focus should be outside of popover or not |
shouldFlip | boolean | true | Whether the element should flip its orientation when there is insufficient room. |
initialFocusRef | React.RefObject<any> | - | The ref of element to receive focus when the popover opens. |
finalFocusRef | React.RefObject<any> | - | The ref of element to receive focus when the popover closes |
trigger | () => any | - | Function that returns a React Element. This element will be used as a Trigger for the popover. |
crossOffset | number | - | The additional offset applied along the cross axis between the element and its trigger element. |
offset | number | - | The additional offset applied along the main axis between the element and its trigger element. |
shouldOverlapWithTrigger | boolean | false | Determines whether popover content should overlap with the trigger. |
isKeyboardDismissable | boolean | - | If true, the keyboard can dismiss the popover. |
placement | 'top' | 'top left' | 'top right' | 'bottom' | 'bottom left' | 'bottom right' | 'right' | 'right top' | 'right bottom' | 'left' | 'left top' | 'left bottom' | 'bottom' | Popover placement |
useRNModal | boolean | false | If true, renders react-native native modal. |
avoidKeyboard | boolean | - | If true, the popover will avoid the keyboard. |
onOpen | () => any | - | This function will be invoked when popover is opened. |
onClose | () => any | - | This function will be invoked when popover is closed. |
children | any | - | The content to display inside the popover. |
| Name | Value | Default |
|---|---|---|
size | xs | sm | md | lg | full | md |