ComponentsPopover

Popover

Displays rich content in a portal, triggered by a button.


import { IconButton } from '@immit/ui/icon-button'
import { Input } from '@immit/ui/input'
import { Label } from '@immit/ui/label'
import { Popover, PopoverContent, PopoverTrigger } from '@immit/ui/popover'
import { Settings2 } from 'lucide-react'
 
export function PopoverDemo() {
  return (
    <Popover>
      <PopoverTrigger asChild>
        <IconButton variant="outline" aria-label="Open popover">
          <Settings2 />
        </IconButton>
      </PopoverTrigger>
      <PopoverContent>
        <div className="grid gap-4">
          <div className="space-y-2">
            <h4 className="font-medium leading-none">Dimensions</h4>
            <p className="text-muted text-sm">
              Set the dimensions for the layer.
            </p>
          </div>
          <div className="grid gap-2">
            <div className="grid grid-cols-3 items-center gap-4">
              <Label htmlFor="width">Width</Label>
              <Input
                id="width"
                defaultValue="100%"
                className="col-span-2"
                size="sm"
              />
            </div>
            <div className="grid grid-cols-3 items-center gap-4">
              <Label htmlFor="maxWidth">Max. width</Label>
              <Input
                id="maxWidth"
                defaultValue="300px"
                className="col-span-2"
                size="sm"
              />
            </div>
            <div className="grid grid-cols-3 items-center gap-4">
              <Label htmlFor="height">Height</Label>
              <Input
                id="height"
                defaultValue="25px"
                className="col-span-2"
                size="sm"
              />
            </div>
            <div className="grid grid-cols-3 items-center gap-4">
              <Label htmlFor="maxHeight">Max. height</Label>
              <Input
                id="maxHeight"
                defaultValue="none"
                className="col-span-2"
                size="sm"
              />
            </div>
          </div>
        </div>
      </PopoverContent>
    </Popover>
  )
}