Displays rich content in a portal, triggered by a button.
Props
Popover
Prop
Type
Default
Description
...Radix props
ComponentProps<typeof PopoverPrimitive.Root>
-
All Radix Popover root props
PopoverContent
Prop
Type
Default
Description
align
'start' | 'center' | 'end'
'center'
Content alignment relative to trigger
sideOffset
number
4
Offset in pixels from the trigger
...Radix props
ComponentProps<typeof PopoverPrimitive.Content>
-
All Radix content props
Usage
<Popover><PopoverTriggerasChild><Buttonvariant="outline">Open popover</Button></PopoverTrigger><PopoverContentclassName="w-80"align="start"onOpenAutoFocus={(e)=>{ e.preventDefault();}}><div><divclassName="space-y-2 mb-2"><h4className="leading-none font-medium">Dimensions</h4><pclassName="text-muted-foreground text-sm"> Set the dimensions for the layer.
</p></div><divclassName="space-y-2"><FormLayoutasChildclassName="w-2xs"orientation="label-left"><label><pclassName="text-uk-md text-left">Width</p><InputRootid="width"defaultValue="300px"/></label></FormLayout><FormLayoutasChildclassName="w-2xs"orientation="label-left"><label><pclassName="text-uk-md text-left">Max width</p><InputRootid="maxWidth"defaultValue="300px"/></label></FormLayout><FormLayoutasChildclassName="w-2xs"orientation="label-left"><label><pclassName="text-uk-md text-left">Height</p><InputRootid="height"defaultValue="300px"/></label></FormLayout><FormLayoutasChildclassName="w-2xs"orientation="label-left"><label><pclassName="text-uk-md text-left">Max height</p><InputRootid="maxHeight"defaultValue="300px"/></label></FormLayout></div></div></PopoverContent></Popover>