Popover

Use the popover component to show detailed information inside a pop-up box relative to the element that is being clicked or hovered based on multiple styles

Get started with the popover component to show any type of content inside a pop-up box when hovering or clicking over a trigger element. There are multiple examples that you can choose from, such as showing more information about a user profile, company profile, password strength, and more.

Make sure that you have the Flowbite JavaScript included in your project to enable the popover interactivity by following the quickstart guide.

Setup

<script>
  import { Popover } from 'flowbite-svelte'
</script>

Default popover

  <Button  id="b1">Default popover</Button>
  <Popover class="w-64 text-sm font-light " title="Popover title" triggeredBy="#b1">
      And here's some amazing content. It's very engaging. Right?
  </Popover>

User profile

Use this example to show more information about a user profile when hovering over the trigger component.

<Button  id="b2">User profile</Button>
<Popover triggeredBy="#b2" class="w-64 text-sm font-light text-gray-500 bg-white dark:text-gray-400 dark:border-gray-600 dark:bg-gray-800">
  <div class="p-3">
      <div class="flex justify-between items-center mb-2">
          <Avatar href="/" src="/images/profile-picture-1.webp" alt="Jese Leos" />
          <Button size="xs">Follow</Button>
      </div>
      <div class="text-base font-semibold leading-none text-gray-900 dark:text-white">
          <a href="/">Jese Leos</a>
      </div>
      <div class="mb-3 text-sm font-normal">
          <a href="/" class="hover:underline">@jeseleos</a>
      </div>
      <div class="mb-4 text-sm font-light">Open-source contributor. Building <a href="/" class="text-blue-600 dark:text-blue-500 hover:underline">flowbite.com</a>.</div>
      <ul class="flex text-sm font-light">
          <li class="mr-2">
              <a href="/" class="hover:underline">
                  <span class="font-semibold text-gray-900 dark:text-white">799</span>
                  <span>Following</span>
              </a>
          </li>
          <li>
              <a href="/" class="hover:underline">
                  <span class="font-semibold text-gray-900 dark:text-white">3,758</span>
                  <span>Followers</span>
              </a>
          </li>
      </ul>
  </div>
</Popover>

Description popover

Show helpful information inside a popover when hovering over a question mark button.

This is just some informational text
Show information
<div class="flex items-center text-sm font-light text-gray-500 dark:text-gray-400">This is just some informational text
  <div id="b3"><QuestionMarkCircle class="ml-1 w-4 h-4" variation="solid"/><span class="sr-only">Show information</span></div>
</div>
<Popover triggeredBy="#b3" class="w-72 text-sm font-light text-gray-500 bg-white dark:bg-gray-800 dark:border-gray-600 dark:text-gray-400" placement="bottom-start">
  <div class="p-3 space-y-2">
      <h3 class="font-semibold text-gray-900 dark:text-white">Activity growth - Incremental</h3>
      Report helps navigate cumulative growth of community activities. Ideally, the chart should have a growing trend, as stagnating chart signifies a significant decrease of community activity.
      <h3 class="font-semibold text-gray-900 dark:text-white">Calculation</h3>
      For each date bucket, the all-time volume of activities is calculated. This means that activities in period n contain all activities up to period n, plus the activities generated by your community in period.
      <a href="/" class="flex items-center font-medium text-blue-600 dark:text-blue-500 dark:hover:text-blue-600 hover:text-blue-700">Read more <ChevronRight size="12" /></a>
  </div>
</Popover>

Placement

Set the position of the popover component relative to the trigger element by using the placement={top|right|bottom|left} data attribute and its values.

  <Button id="placement-left" on:mouseenter={()=> placement = 'left'}>Left popover</Button>
  <Button id="placement-top2" on:mouseenter={()=> placement = 'top'}>Top popover</Button>
  <Button id="placement-bottom" on:mouseenter={()=> placement = 'bottom'}>Bottom popover</Button>
  <Button id="placement-right" on:mouseenter={()=> placement = 'right'}>Right popover</Button>
  <Popover triggeredBy="[id^='placement-']" {placement} class="w-64 text-sm font-light " title="Popover left">
      And here's some amazing content. It's very engaging. Right?
  </Popover>

Triggering

<Button id='click'>Click popover</Button>
<Button id='click1' color="green">Another click popover</Button>
<Popover class="w-64 text-sm font-light " title="Popover title" triggeredBy="#click,#click1" trigger="click">
  And here's some amazing content. It's very engaging. Right?
</Popover>

Props

The component has the following props, type, and default values. See types page for type information.

Modal

Name Type Default
title string ''

References