Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Overlays

Popover

Small floating panel anchored to a trigger: quick forms, details, filters. Esc or an outside click closes it.

import { Popover } from "@stylhero/ui";

Example

Code
import { Button, Input, Popover, Stack } from "@stylhero/ui";

function PopoverExample() {
  return (
    <Popover title="Share this build" trigger={<Button variant="secondary">Share</Button>}>
      <Stack gap={3}>
        <Input label="Link" defaultValue="https://example.com/b/42" readOnly />
        <Button size="sm">Copy link</Button>
      </Stack>
    </Popover>
  );
}

Props

PropTypeDefaultDescription
children required ReactNode -
trigger required ReactElement - The element that opens it on click, e.g. <Button>.
className string -
onOpenChange (open: boolean) => void -
open boolean - Controlled open state.
placement Placement "bottom-start"
title ReactNode -

Keyboard

KeyDoes
Enter / SpaceOpens it from the trigger
EscCloses it and returns focus to the trigger

Accessibility

  • A non-modal role="dialog": focus moves into it when it opens, and Tab can leave it.

Generated from src/components/Popover.tsx. Something wrong or missing? Open an issue.