chrome
<tc-popover>
Click-triggered floating panel anchored to a slotted trigger. Outside-click and Esc close, auto-flips on overflow. Top-layer rendering.
import
"@ra9/tan-compose-kit/popover"
Props
| Name | Type | Default | Description |
|---|---|---|---|
open | boolean | false | Whether the popover is showing. Reflects to the `open` attribute. |
placement | "top" | "bottom" | "left" | "right" | "bottom" | Preferred side. Auto-flips when there isn't room. |
offset | number | 8 | Gap between trigger and panel, in pixels. |
dismissible | boolean | true | Close on outside click and Esc. |
Events
| Event | Detail | When |
|---|---|---|
tc-open | — | Fires when the popover opens. |
tc-close | { reason: "outside" | "escape" | "trigger" | "api" } | Fires when the popover closes. `reason` reports what dismissed it. |
Slots
| Slot | Description |
|---|---|
trigger | The element that toggles the popover when clicked. |
(default) | Popover content. |
CSS variables
| Variable | Default | Description |
|---|---|---|
--tc-popover-bg | var(--tc-color-surface, #ffffff) | Panel background. |
--tc-popover-fg | var(--tc-color-ink, #14171f) | Panel text color. |
--tc-popover-rule | var(--tc-color-rule, #ece5d3) | Border color. |
--tc-popover-radius | var(--tc-radius-md, 8px) | Corner radius. |
--tc-popover-shadow | var(--tc-shadow-lg, …) | Drop shadow. |
--tc-popover-padding | 12px 14px | Inner padding. |
--tc-popover-min-width | 200px | Minimum width. |
--tc-popover-max-width | 340px | Maximum width. |
Examples
Basic
Placement
Filter form
Popovers shine for compact forms anchored to a trigger — date pickers, filter pills, formatting toolbars.
Status
Reset
Apply
Non-dismissible
Use dismissible="false" for confirmation flows where you want the user to make a choice rather than dismiss by clicking away.
Controlled
Accessibility
- The panel has
role="dialog". Use it for short interactive surfaces. For long-form modal flows, prefer<tc-modal>. Escand outside click both close (unlessdismissible="false").- Trigger uses any element you slot in. Make sure it's a real
<button>or hasrole="button"andtabindex="0"for keyboard activation. - The popover renders in the browser top-layer, so it sits above
transform,backdrop-filter, andoverflow: hiddenancestors.