Skip to content

Popover

Interactive content anchored to a trigger, such as a small form.

Base UI0.9 kB gzipSource Registry JSON

PopoverContent playground

Props

side
align

Installation

npx shadcn@latest add https://sproutboat.com/ikada/r/popover.json

The CLI writes components/ikada/popover.tsx and merges the ikada theme into your CSS. Or take it from the package: import { Popover, PopoverContent, PopoverTitle, PopoverDescription } from "@sproutboat/ikada";

Usage

import { Popover, PopoverContent, PopoverTitle, PopoverDescription } from "@/components/ikada/popover";

<Popover>
  <PopoverTrigger render={<Button />}>Rollout</PopoverTrigger>
  <PopoverContent side="right" align="center">
    <PopoverTitle>Rollout</PopoverTitle>
    <PopoverDescription>Send 10% of traffic to the new version first.</PopoverDescription>
  </PopoverContent>
</Popover>

Examples

Rollout

Interactive content anchored to its trigger. Plain text belongs in a Tooltip.

Small form

PopoverClose closes it from inside, for a confirming button.

Placement

Choose the side and alignment; it flips when there is no room.

Props

PopoverContentProps
PropTypeDescription
classNamestringClasses merged onto the root element, after ikada's own.
sideSideWhich side of the trigger the popup opens on. Flips when there is no room. Default `bottom`.
alignAlignHow the popup lines up with the trigger along that side. Default `start`.
styleCSSProperties | ((state: PopoverPopupState) => CSSProperties)Style applied to the element, or a function that returns a style object based on the component's state.
renderReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, PopoverPopupState>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.

Also takes every prop of Omit<ComponentProps<typeof BasePopover.Popup>, "className">.

PopoverTitleProps
PropTypeDescription
styleCSSProperties | ((state: PopoverTitleState) => CSSProperties)Style applied to the element, or a function that returns a style object based on the component's state.
renderReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, PopoverTitleState>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
classNamestringClasses merged onto the root element, after ikada's own.
PopoverDescriptionProps
PropTypeDescription
styleCSSProperties | ((state: PopoverDescriptionState) => CSSProperties)Style applied to the element, or a function that returns a style object based on the component's state.
renderReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, PopoverDescriptionState>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
classNamestringClasses merged onto the root element, after ikada's own.

Source: src/components/popover.tsx