v1.3.0 28

Popover

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

Interactive Requires: veritheme.js JS init: automatic

Default

html

Dimensions

Set the dimensions for the layer.

<div class="vt-popover-wrap">
  <button class="vt-btn vt-btn-bordered" data-vt-popover-trigger="pop1">
    Open popover
  </button>
  <div id="pop1" class="vt-popover-content vt-popover-bottom-start vt-w-80">
    <div class="vt-popover-header">
      <h4 class="vt-popover-title">Dimensions</h4>
      <p class="vt-popover-description">Set the dimensions for the layer.</p>
    </div>
    <div class="vt-grid vt-grid-cols-2 vt-gap-3">
      <div class="vt-field">
        <label class="vt-label" for="popover-1-1">Width</label>
        <input type="text" value="100%" aria-label="Width" class="vt-input vt-input-sm" id="popover-1-1">
      </div><div class="vt-field">
        <label class="vt-label" for="popover-1-2">Height</label>
        <input type="text" value="25px" aria-label="Height" class="vt-input vt-input-sm" id="popover-1-2">
      </div><div class="vt-field">
        <label class="vt-label" for="popover-1-3">Max width</label>
        <input type="text" value="300px" aria-label="Max width" class="vt-input vt-input-sm" id="popover-1-3">
      </div><div class="vt-field">
        <label class="vt-label" for="popover-1-4">Max height</label>
        <input type="text" value="none" aria-label="Max height" class="vt-input vt-input-sm" id="popover-1-4">
      </div>
    </div>
  </div>
</div>

User Card

html
J

John Doe

@johndoe

Full-stack developer. Building Veritheme. Open source enthusiast.

256 following 1.2k followers
<div class="vt-popover-wrap">
  <button class="vt-btn vt-btn-ghost" data-vt-popover-trigger="pop2">

    <span class="vt-avatar vt-avatar-sm"><span>J</span></span>
    @johndoe
  </button>
  <div id="pop2" class="vt-popover-content vt-popover-bottom-start">
    <div class="vt-flex vt-items-center vt-gap-3">
      <span class="vt-avatar vt-avatar-md"><span>J</span></span>
      <div class="vt-popover-header">
        <h4 class="vt-popover-title">John Doe</h4>
        <p class="vt-popover-description">@johndoe</p>
      </div>
    </div>
    <p class="vt-body-sm vt-text-foreground-muted">Full-stack developer. Building Veritheme. Open source enthusiast.</p>
    <div class="vt-flex vt-gap-4 vt-caption vt-text-foreground-muted">
      <span><strong class="vt-text-foreground-primary">256</strong> following</span>
      <span><strong class="vt-text-foreground-primary">1.2k</strong> followers</span>
    </div>
  </div>
</div>

Placements

Popover can open from all sides: top, right, bottom, and left.

html

Top popover

Opens above the trigger.

Right popover

Opens to the right side.

Bottom popover

Default bottom placement.

Left popover

Opens to the left side.

<div class="vt-grid vt-grid-cols-2 vt-gap-12 vt-w-full vt-max-w-md vt-place-items-center">
  <div class="vt-popover-wrap">
    <button class="vt-btn vt-btn-secondary" data-vt-popover-trigger="pop3">
      Top
    </button>
    <div id="pop3" class="vt-popover-content vt-popover-top vt-w-56">
      <div class="vt-popover-header">
        <h4 class="vt-popover-title">Top popover</h4>
        <p class="vt-popover-description">Opens above the trigger.</p>
      </div>
    </div>
  </div><div class="vt-popover-wrap">
    <button class="vt-btn vt-btn-secondary" data-vt-popover-trigger="pop4">
      Right
    </button>
    <div id="pop4" class="vt-popover-content vt-popover-right vt-w-56">
      <div class="vt-popover-header">
        <h4 class="vt-popover-title">Right popover</h4>
        <p class="vt-popover-description">Opens to the right side.</p>
      </div>
    </div>
  </div><div class="vt-popover-wrap">
    <button class="vt-btn vt-btn-secondary" data-vt-popover-trigger="pop5">
      Bottom
    </button>
    <div id="pop5" class="vt-popover-content vt-popover-bottom vt-w-56">
      <div class="vt-popover-header">
        <h4 class="vt-popover-title">Bottom popover</h4>
        <p class="vt-popover-description">Default bottom placement.</p>
      </div>
    </div>
  </div><div class="vt-popover-wrap">
    <button class="vt-btn vt-btn-secondary" data-vt-popover-trigger="pop6">
      Left
    </button>
    <div id="pop6" class="vt-popover-content vt-popover-left vt-w-56">
      <div class="vt-popover-header">
        <h4 class="vt-popover-title">Left popover</h4>
        <p class="vt-popover-description">Opens to the left side.</p>
      </div>
    </div>
  </div>
</div>

Static Preview

Popover content inline for reference, with actions.

html

Archive project?

You can restore it from Settings.

<div class="vt-popover-content vt-popover-static">
  <div class="vt-popover-header">
    <h4 class="vt-popover-title">Archive project?</h4>
    <p class="vt-popover-description">You can restore it from Settings.</p>
  </div>
  <div class="vt-popover-footer">
    <button class="vt-btn vt-btn-bordered vt-btn-sm">
      Cancel
    </button>
    <button class="vt-btn vt-btn-primary vt-btn-sm">
      Archive
    </button>
  </div>
</div>

Guidelines

Filter results

Narrow the list without leaving the page.

Do Anchor a popover to its trigger for lightweight, non-blocking tasks.

Permanently delete account?

This removes all your data and cannot be undone.

Don't Don't cram blocking or critical flows into a popover — use a dialog.

API Reference

Class Type Description
[data-vt-popover-trigger] Attribute Trigger button — value matches popover ID
vt-popover-wrap Base Positioning anchor around the trigger and the popover
vt-popover-content Base The popover card: 288px wide, 16px padding, 12px gap between its parts — hidden by default
vt-open State Applied when popover is visible
vt-popover-header Part Title and description, 4px apart
vt-popover-title Part Title — Label/MD
vt-popover-description Part Supporting text — Caption, muted
vt-popover-footer Part Actions row, aligned to the end (small vt-btn)
vt-popover-top Placement Positions popover above trigger
vt-popover-bottom Placement Positions popover below trigger
vt-popover-left Placement Positions popover to the left of trigger
vt-popover-right Placement Positions popover to the right of trigger
vt-popover-bottom-start Placement Bottom placement aligned to start edge
vt-popover-static Modifier Shows the popover in the flow (a preview, or a card inside a panel)

Accessibility

Feature Details
Trigger Use <button> element for trigger, not div or span
ARIA Add aria-expanded on trigger, aria-labelledby on popover content
Focus Trap Trap focus within popover when open, restore to trigger on close
Keyboard Escape closes popover, Tab cycles through focusable elements inside
Click Outside Clicking outside popover closes it automatically