A floating panel anchored to a trigger that resizes smoothly with its content and follows the trigger’s direction.
Install
Add it to your project
Run this in a project set up for shadcn/ui. It writes the files and installs the npm packages.
First time: connect the Infinity UI registry
- Create a personal token on your Tokens page.
- Put it in
.env.localasINFINITYUI_TOKEN. - Add the registry to
components.json:
{
"registries": {
"@infinityui": {
"url": "https://infinityui.io/r/{name}.json",
"headers": {
"Authorization": "Bearer ${INFINITYUI_TOKEN}"
}
}
}
}Using Claude Code, Codex, Cursor, Lovable or v0? See CLI & MCP for a setup prompt.
npm packages it adds
- cn
- @base-ui/react
Code
import { IconAdjustmentsHorizontal } from "@tabler/icons-react"
import { Button } from "@/components/ui/button"
import {
Popover,
PopoverClose,
PopoverContent,
PopoverDescription,
PopoverHeader,
PopoverTitle,
PopoverTrigger,
} from "@/components/ui/popover"
const field =
"h-8 w-full min-w-0 rounded-md border bg-transparent px-2 text-sm outline-none focus-visible:outline-hidden focus-visible:ring-3 focus-visible:ring-focus-ring pointer-coarse:h-11 pointer-coarse:text-lg"
export function PopoverDemo() {
return (
<Popover>
<PopoverTrigger render={<Button variant="outline" />}>
<IconAdjustmentsHorizontal />
Dimensions
</PopoverTrigger>
<PopoverContent>
<PopoverHeader>
<PopoverTitle>Dimensions</PopoverTitle>
<PopoverDescription>
Set the dimensions for the layer.
</PopoverDescription>
</PopoverHeader>
<div className="grid grid-cols-[5rem_minmax(0,1fr)] items-center gap-2">
<label htmlFor="popover-width" className="text-sm">
Width
</label>
<input id="popover-width" className={field} defaultValue="100%" />
<label htmlFor="popover-height" className="text-sm">
Height
</label>
<input id="popover-height" className={field} defaultValue="25px" />
</div>
<div className="flex justify-end gap-2">
<PopoverClose render={<Button variant="ghost" size="sm" />}>
Cancel
</PopoverClose>
<PopoverClose render={<Button size="sm" />}>Apply</PopoverClose>
</div>
</PopoverContent>
</Popover>
)
}
































