flowbite-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +324 -0
  3. package/build/index.js +975 -0
  4. package/build/server-runner.js +228 -0
  5. package/data/components/accordion.md +860 -0
  6. package/data/components/alerts.md +739 -0
  7. package/data/components/avatar.md +178 -0
  8. package/data/components/badge.md +420 -0
  9. package/data/components/banner.md +145 -0
  10. package/data/components/bottom-navigation.md +513 -0
  11. package/data/components/breadcrumb.md +273 -0
  12. package/data/components/button-group.md +410 -0
  13. package/data/components/buttons.md +405 -0
  14. package/data/components/card.md +711 -0
  15. package/data/components/carousel.md +858 -0
  16. package/data/components/chat-bubble.md +1063 -0
  17. package/data/components/clipboard.md +1029 -0
  18. package/data/components/datepicker.md +673 -0
  19. package/data/components/device-mockups.md +152 -0
  20. package/data/components/drawer.md +1353 -0
  21. package/data/components/dropdowns.md +1925 -0
  22. package/data/components/footer.md +299 -0
  23. package/data/components/forms.md +371 -0
  24. package/data/components/gallery.md +322 -0
  25. package/data/components/indicators.md +262 -0
  26. package/data/components/jumbotron.md +213 -0
  27. package/data/components/kbd.md +217 -0
  28. package/data/components/list-group.md +365 -0
  29. package/data/components/mega-menu.md +558 -0
  30. package/data/components/modal.md +1309 -0
  31. package/data/components/navbar.md +1053 -0
  32. package/data/components/pagination.md +472 -0
  33. package/data/components/popover.md +826 -0
  34. package/data/components/progress.md +95 -0
  35. package/data/components/qr-code.md +280 -0
  36. package/data/components/rating.md +323 -0
  37. package/data/components/sidebar.md +1067 -0
  38. package/data/components/skeleton.md +221 -0
  39. package/data/components/speed-dial.md +1270 -0
  40. package/data/components/spinner.md +222 -0
  41. package/data/components/stepper.md +271 -0
  42. package/data/components/tables.md +3127 -0
  43. package/data/components/tabs.md +808 -0
  44. package/data/components/timeline.md +304 -0
  45. package/data/components/toast.md +341 -0
  46. package/data/components/tooltips.md +524 -0
  47. package/data/components/typography.md +269 -0
  48. package/data/components/video.md +95 -0
  49. package/data/forms/checkbox.md +375 -0
  50. package/data/forms/file-input.md +98 -0
  51. package/data/forms/floating-label.md +185 -0
  52. package/data/forms/input-field.md +222 -0
  53. package/data/forms/number-input.md +1099 -0
  54. package/data/forms/phone-input.md +577 -0
  55. package/data/forms/radio.md +315 -0
  56. package/data/forms/range.md +83 -0
  57. package/data/forms/search-input.md +280 -0
  58. package/data/forms/select.md +259 -0
  59. package/data/forms/textarea.md +155 -0
  60. package/data/forms/timepicker.md +732 -0
  61. package/data/forms/toggle.md +176 -0
  62. package/data/plugins/charts.md +2683 -0
  63. package/data/plugins/datatables.md +1922 -0
  64. package/data/plugins/datepicker.md +5 -0
  65. package/data/plugins/wysiwyg.md +2377 -0
  66. package/data/quickstart.md +169 -0
  67. package/data/theme.md +231 -0
  68. package/data/toc.md +79 -0
  69. package/data/typography/blockquote.md +182 -0
  70. package/data/typography/headings.md +174 -0
  71. package/data/typography/hr.md +74 -0
  72. package/data/typography/images.md +168 -0
  73. package/data/typography/links.md +118 -0
  74. package/data/typography/lists.md +387 -0
  75. package/data/typography/paragraphs.md +186 -0
  76. package/data/typography/text.md +249 -0
  77. package/package.json +71 -0
@@ -0,0 +1,826 @@
1
+ ---
2
+ layout: docs
3
+ title: Tailwind CSS Popover - Flowbite
4
+ description: 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
5
+ group: components
6
+ toc: true
7
+ requires_js: true
8
+
9
+ previous: Pagination
10
+ previousLink: components/pagination/
11
+
12
+ next: Progress bar
13
+ nextLink: components/progress/
14
+ ---
15
+
16
+ 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.
17
+
18
+ Make sure that you have the Flowbite JavaScript included in your project to enable the popover interactivity by following the <a href="{{< ref "getting-started/quickstart" >}}">quickstart guide</a>.
19
+
20
+ ## Default popover
21
+
22
+ Initialize a new popover by adding the `data-popover-target="{elementId}"` data attribute to the trigger element where `elementId` is the id of the popover component.
23
+
24
+ {{< example class="flex justify-center pt-32" github="components/popover.md" show_dark=true >}}
25
+ <button data-popover-target="popover-default" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Default popover</button>
26
+
27
+ <div data-popover id="popover-default" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
28
+ <div class="px-3 py-2 bg-neutral-tertiary border-b border-default rounded-t-base">
29
+ <h3 class="font-medium text-heading">Popover title</h3>
30
+ </div>
31
+ <div class="px-3 py-2">
32
+ <p>And here's some amazing content. It's very engaging. Right?</p>
33
+ </div>
34
+ <div data-popper-arrow></div>
35
+ </div>
36
+ {{< /example >}}
37
+
38
+ ## User profile
39
+
40
+ Use this example to show more information about a user profile when hovering over the trigger component.
41
+
42
+ {{< example class="flex justify-center pt-60" github="components/popover.md" show_dark=true >}}
43
+ <button data-popover-target="popover-user-profile" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">User profile</button>
44
+
45
+ <div data-popover id="popover-user-profile" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
46
+ <div class="p-3">
47
+ <div class="flex items-center justify-between mb-2">
48
+ <a href="#">
49
+ <img class="w-8 h-8 rounded-full" src="/docs/images/people/profile-picture-1.jpg" alt="Jese Leos">
50
+ </a>
51
+ <div>
52
+ <button type="button" class="text-white bg-brand hover:bg-brand-strong box-border border border-transparent focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded text-xs px-3 py-1.5 focus:outline-none">Follow</button>
53
+ </div>
54
+ </div>
55
+ <p class="text-sm font-semibold text-heading">
56
+ <a href="#">Jese Leos</a>
57
+ </p>
58
+ <p class="mb-3 text-sm font-normal text-body">
59
+ <a href="#" class="hover:underline">@jeseleos</a>
60
+ </p>
61
+ <p class="mb-4 text-sm">Open-source contributor & CEO. Building <a href="#" class="text-fg-brand hover:underline">flowbite.com</a>.</p>
62
+ <ul class="flex text-sm">
63
+ <li class="me-2.5">
64
+ <a href="#" class="hover:underline">
65
+ <span class="font-medium text-heading">799</span>
66
+ <span>Following</span>
67
+ </a>
68
+ </li>
69
+ <li>
70
+ <a href="#" class="hover:underline">
71
+ <span class="font-medium text-heading">3,758</span>
72
+ <span>Followers</span>
73
+ </a>
74
+ </li>
75
+ </ul>
76
+ </div>
77
+ <div data-popper-arrow></div>
78
+ </div>
79
+ {{< /example >}}
80
+
81
+ ## Company profile
82
+
83
+ This example can be used to show more information about a company profile.
84
+
85
+ {{< example class="flex justify-center pt-80" github="components/popover.md" disable_init_js=true show_dark=true >}}
86
+ <button data-popover-target="popover-company-profile" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Company profile</button>
87
+
88
+ <div data-popover id="popover-company-profile" role="tooltip" class="absolute z-10 invisible inline-block w-80 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
89
+ <div class="p-3">
90
+ <div class="flex">
91
+ <div class="me-3 shrink-0">
92
+ <a href="#" class="block w-10 h-10 flex items-center justify-center p-2 bg-neutral-tertiary rounded">
93
+ <img class="w-8 h-8 rounded-full" src="https://flowbite.com/docs/images/logo.svg" alt="Flowbite logo">
94
+ </a>
95
+ </div>
96
+ <div>
97
+ <p class="text-base font-semibold text-heading">
98
+ <a href="#" class="hover:underline">Flowbite</a>
99
+ </p>
100
+ <p class="mb-3 text-sm font-normal">
101
+ Tech company
102
+ </p>
103
+ <p class="mb-3 text-sm">Breaking news alerts and the most talked about stories.</p>
104
+ <ul class="text-sm">
105
+ <li class="flex items-center mb-2">
106
+ <span class="me-2 font-semibold text-body">
107
+ <svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.213 9.787a3.391 3.391 0 0 0-4.795 0l-3.425 3.426a3.39 3.39 0 0 0 4.795 4.794l.321-.304m-.321-4.49a3.39 3.39 0 0 0 4.795 0l3.424-3.426a3.39 3.39 0 0 0-4.794-4.795l-1.028.961"/></svg>
108
+ </span>
109
+ <a href="#" class="font-medium text-fg-brand hover:underline">https://flowbite.com/</a>
110
+ </li>
111
+ <li class="flex items-start mb-2">
112
+ <span class="me-2 text-body">
113
+ <svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12.01 6.001C6.5 1 1 8 5.782 13.001L12.011 20l6.23-7C23 8 17.5 1 12.01 6.002Z"/></svg>
114
+ </span>
115
+ <span class="-mt-1">102,567,936 people like this including 5 of your friends</span>
116
+ </li>
117
+ </ul>
118
+ <div class="flex mb-4 -space-x-3 rtl:space-x-reverse">
119
+ <img class="w-8 h-8 border-2 border-buffer-medium rounded-full" src="/docs/images/people/profile-picture-5.jpg" alt="">
120
+ <img class="w-8 h-8 border-2 border-buffer-medium rounded-full" src="/docs/images/people/profile-picture-2.jpg" alt="">
121
+ <img class="w-8 h-8 border-2 border-buffer-medium rounded-full" src="/docs/images/people/profile-picture-3.jpg" alt="">
122
+ <a class="flex items-center justify-center w-8 h-8 text-xs font-medium text-heading bg-neutral-tertiary border-2 border-buffer-medium rounded-full hover:bg-neutral-quaternary" href="#">+3</a>
123
+ </div>
124
+ <div class="flex space-x-2">
125
+ <button type="button" class="flex items-center justify-center w-full text-body bg-neutral-primary-medium border border-default-medium hover:bg-neutral-secondary-strong hover:text-heading hover:border-default-strong focus:ring-4 focus:ring-neutral-tertiary-soft shadow-xs font-medium leading-5 rounded-base text-sm px-3 py-2 focus:outline-none">
126
+ <svg class="w-4 h-4 me-1.5 -ms-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 11c.889-.086 1.416-.543 2.156-1.057a22.323 22.323 0 0 0 3.958-5.084 1.6 1.6 0 0 1 .582-.628 1.549 1.549 0 0 1 1.466-.087c.205.095.388.233.537.406a1.64 1.64 0 0 1 .384 1.279l-1.388 4.114M7 11H4v6.5A1.5 1.5 0 0 0 5.5 19v0A1.5 1.5 0 0 0 7 17.5V11Zm6.5-1h4.915c.286 0 .372.014.626.15.254.135.472.332.637.572a1.874 1.874 0 0 1 .215 1.673l-2.098 6.4C17.538 19.52 17.368 20 16.12 20c-2.303 0-4.79-.943-6.67-1.475"/></svg>
127
+ Like page
128
+ </button>
129
+ <button id="dropdown-button" data-dropdown-toggle="dropdown-menu" data-dropdown-placement="right" type="button" class="flex items-center justify-center text-body bg-neutral-primary-medium border border-default-medium hover:bg-neutral-secondary-strong hover:text-heading hover:border-default-strong focus:ring-4 focus:ring-neutral-tertiary-soft shadow-xs font-medium leading-5 rounded-base w-9 h-9 shrink-0 focus:outline-none">
130
+ <svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="3" d="M6 12h.01m6 0h.01m5.99 0h.01"/></svg>
131
+ </button>
132
+ </div>
133
+ <div id="dropdown-menu" class="z-10 hidden bg-neutral-primary-medium border border-default-medium rounded-base shadow-lg w-44">
134
+ <ul class="p-2 text-sm text-body font-medium" aria-labelledby="dropdown-button">
135
+ <li>
136
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Report this page</a>
137
+ </li>
138
+ <li>
139
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Add to favorites</a>
140
+ </li>
141
+ <li>
142
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Block this page</a>
143
+ </li>
144
+ <li>
145
+ <a href="#" class="inline-flex items-center w-full p-2 hover:bg-neutral-tertiary-medium hover:text-heading rounded">Invite users</a>
146
+ </li>
147
+ </ul>
148
+ </div>
149
+ </div>
150
+ </div>
151
+ </div>
152
+ <div data-popper-arrow></div>
153
+ </div>
154
+ {{< /example >}}
155
+
156
+ ## Image popover
157
+
158
+ Use this example to trigger a popover component with detailed information and an image when hovering over a portion of highlighted text inspired by Wikipedia and other large news outlets.
159
+
160
+ {{< example class="flex justify-center pt-72" github="components/popover.md" show_dark=true >}}
161
+
162
+ <p class="text-body">Due to its central geographic location in Southern Europe, <a href="#" class="text-fg-brand font-medium underline hover:no-underline" data-popover-target="popover-image">Italy</a> has historically been home to myriad peoples and cultures. In addition to the various ancient peoples dispersed throughout what is now modern-day Italy, the most predominant being the Indo-European Italic peoples who gave the peninsula its name, beginning from the classical era, Phoenicians and Carthaginians founded colonies mostly in insular Italy</p>
163
+ <div data-popover id="popover-image" role="tooltip" class="absolute z-10 p-3 invisible inline-block text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-lg shadow-xs opacity-0 w-96">
164
+ <div class="grid grid-cols-5">
165
+ <div class="col-span-3 pe-3">
166
+ <div class="space-y-2">
167
+ <h3 class="font-semibold text-heading">About Italy</h3>
168
+ <p class="mb-2">Italy is located in the middle of the Mediterranean Sea, in Southern Europe it is also part of Western Europe.</p>
169
+ <p>A unitary parliamentary republic with Rome as its capital and largest city.</p>
170
+ <a href="#" class="flex items-center font-medium text-fg-brand hover:underline">
171
+ Read more
172
+ <svg class="w-4 h-4 ms-1 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 12H5m14 0-4 4m4-4-4-4"/></svg>
173
+ </a>
174
+ </div>
175
+ </div>
176
+ <img src="/docs/images/popovers/italy.png" class="h-full col-span-2 rounded" alt="Italy map" />
177
+ </div>
178
+ <div data-popper-arrow></div>
179
+ </div>
180
+ {{< /example >}}
181
+
182
+ ## Description popover
183
+
184
+ Show helpful information inside a popover when hovering over a question mark button.
185
+
186
+ {{< example class="pb-96" github="components/popover.md" show_dark=true >}}
187
+
188
+ <p class="flex items-center text-sm text-body">This is just some informational text <button data-popover-target="popover-description" data-popover-placement="bottom-end" type="button"><svg class="w-4 h-4 text-body hover:text-heading ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.529 9.988a2.502 2.502 0 1 1 5 .191A2.441 2.441 0 0 1 12 12.582V14m-.01 3.008H12M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg><span class="sr-only">Show information</span></button></p>
189
+ <div data-popover id="popover-description" role="tooltip" class="absolute z-10 p-3 invisible inline-block text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0 w-72">
190
+ <div>
191
+ <h3 class="font-semibold text-heading mb-2">Activity growth - Incremental</h3>
192
+ <p class="mb-4">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.</p>
193
+ <h3 class="font-semibold text-heading mb-2">Calculation</h3>
194
+ <p class="mb-4">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.</p>
195
+ <a href="#" class="flex items-center font-medium text-fg-brand hover:underline">
196
+ Read more
197
+ <svg class="w-4 h-4 ms-1 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 12H5m14 0-4 4m4-4-4-4"/></svg>
198
+ </a>
199
+ </div>
200
+ <div data-popper-arrow></div>
201
+ </div>
202
+ {{< /example >}}
203
+
204
+ ## Progress popover
205
+
206
+ Show a progress bar with details inside a popover when hovering over a settings button.
207
+
208
+ {{< example class="flex justify-center pt-52" github="components/popover.md" show_dark=true >}}
209
+ <button data-popover-target="popover-description" type="button" class="inline-flex items-center text-white bg-brand hover:bg-brand-strong box-border border border-transparent focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">
210
+ <svg class="w-4 h-4 me-1.5 -ms-0.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 6c0 1.657-3.134 3-7 3S5 7.657 5 6m14 0c0-1.657-3.134-3-7-3S5 4.343 5 6m14 0v6M5 6v6m0 0c0 1.657 3.134 3 7 3s7-1.343 7-3M5 12v6c0 1.657 3.134 3 7 3s7-1.343 7-3v-6"/></svg>
211
+ Storage status
212
+ </button>
213
+
214
+ <div data-popover id="popover-description" role="tooltip" class="absolute z-10 p-3 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
215
+ <div class="space-y-2.5">
216
+ <h3 class="font-semibold text-heading">Available storage</h3>
217
+ <p>This server has <span class="font-semibold text-heading">30</span> of <span class="font-semibold text-heading">150 GB</span> of block storage remaining.</p>
218
+ <div class="w-full bg-neutral-quaternary rounded-full h-1.5 mb-4">
219
+ <div class="bg-danger h-1.5 rounded-full" style="width: 85%"></div>
220
+ </div>
221
+ </div>
222
+ <a href="#" class="flex items-center font-medium text-fg-brand hover:underline">
223
+ Upgrade now
224
+ <svg class="w-4 h-4 ms-1 rtl:rotate-180" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 12H5m14 0-4 4m4-4-4-4"/></svg>
225
+ </a>
226
+ <div data-popper-arrow></div>
227
+ </div>
228
+ {{< /example >}}
229
+
230
+ ## Password strength
231
+
232
+ Dynamically show the password strength progress when creating a new password positioned relative to the input element.
233
+
234
+ {{< example github="components/popover.md" iframeHeight="480" show_dark=true >}}
235
+
236
+ <form>
237
+ <div class="mb-6">
238
+ <label for="email" class="block mb-2.5 text-sm font-medium text-heading">Your email</label>
239
+ <input type="email" id="email" class="bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand block w-full px-3 py-2.5 shadow-xs placeholder:text-body" placeholder="name@flowbite.com" required />
240
+ </div>
241
+ <div class="mb-6">
242
+ <label for="password" class="block mb-2.5 text-sm font-medium text-heading">Your password</label>
243
+ <input data-popover-target="popover-password" data-popover-placement="bottom" type="password" id="password" class="bg-neutral-secondary-medium border border-default-medium text-heading text-sm rounded-base focus:ring-brand focus:border-brand block w-full px-3 py-2.5 shadow-xs placeholder:text-body" required />
244
+ <div data-popover id="popover-password" role="tooltip" class="absolute z-10 p-3 invisible inline-block w-72 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
245
+ <div>
246
+ <h3 class="font-semibold text-heading mb-3">Must have at least 6 characters</h3>
247
+ <div class="grid grid-cols-4 gap-2 mb-3">
248
+ <div class="h-1 bg-warning rounded-full"></div>
249
+ <div class="h-1 bg-warning rounded-full"></div>
250
+ <div class="h-1 bg-neutral-quaternary rounded-full"></div>
251
+ <div class="h-1 bg-neutral-quaternary rounded-full"></div>
252
+ </div>
253
+ <p class="mb-2">It’s better to have:</p>
254
+ <ul>
255
+ <li class="flex items-center mb-1">
256
+ <svg class="w-4 h-4 me-1.5 text-success" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 11.917 9.724 16.5 19 7.5"/></svg>
257
+ Upper & lower case letters
258
+ </li>
259
+ <li class="flex items-center mb-1">
260
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18 17.94 6M18 18 6.06 6"/></svg>
261
+ A symbol (#$&)
262
+ </li>
263
+ <li class="flex items-center">
264
+ <svg class="w-4 h-4 me-1.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18 17.94 6M18 18 6.06 6"/></svg>
265
+ A longer password (min. 12 chars.)
266
+ </li>
267
+ </ul>
268
+ </div>
269
+ <div data-popper-arrow></div>
270
+ </div>
271
+ </div>
272
+ <div class="flex items-start mb-6">
273
+ <div class="flex items-center h-5">
274
+ <input id="remember" type="checkbox" value="" class="w-4 h-4 border border-default-strong rounded-xs bg-neutral-secondary-strong focus:ring-2 focus:ring-brand-soft" required />
275
+ </div>
276
+ <label for="remember" class="ms-2 text-sm font-medium text-heading">I agree with the <a href="#" class="text-fg-brand hover:underline">terms and conditions</a>.</label>
277
+ </div>
278
+ <button type="submit" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Submit</button>
279
+ </form>
280
+ {{< /example >}}
281
+
282
+ ## Placement
283
+
284
+ Set the position of the popover component relative to the trigger element by using the `data-popover-placement="{top|right|bottom|left}"` data attribute and its values.
285
+
286
+ {{< example class="flex flex-wrap justify-center py-24 space-x-4" github="components/popover.md" show_dark=true >}}
287
+ <button data-popover-target="popover-top" data-popover-placement="top" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Top popover</button>
288
+
289
+ <div data-popover id="popover-top" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
290
+ <div class="px-3 py-2 bg-neutral-tertiary border-b border-default rounded-t-base">
291
+ <h3 class="font-medium text-heading">Popover top</h3>
292
+ </div>
293
+ <div class="px-3 py-2">
294
+ <p>And here's some amazing content. It's very engaging. Right?</p>
295
+ </div>
296
+ <div data-popper-arrow></div>
297
+ </div>
298
+ <button data-popover-target="popover-right" data-popover-placement="right" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Right popover</button>
299
+ <div data-popover id="popover-right" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
300
+ <div class="px-3 py-2 bg-neutral-tertiary border-b border-default rounded-t-base">
301
+ <h3 class="font-medium text-heading">Popover right</h3>
302
+ </div>
303
+ <div class="px-3 py-2">
304
+ <p>And here's some amazing content. It's very engaging. Right?</p>
305
+ </div>
306
+ <div data-popper-arrow></div>
307
+ </div>
308
+ <button data-popover-target="popover-bottom" data-popover-placement="bottom" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Bottom popover</button>
309
+ <div data-popover id="popover-bottom" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
310
+ <div class="px-3 py-2 bg-neutral-tertiary border-b border-default rounded-t-base">
311
+ <h3 class="font-medium text-heading">Popover bottom</h3>
312
+ </div>
313
+ <div class="px-3 py-2">
314
+ <p>And here's some amazing content. It's very engaging. Right?</p>
315
+ </div>
316
+ <div data-popper-arrow></div>
317
+ </div>
318
+ <button data-popover-target="popover-left" data-popover-placement="left" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Left popover</button>
319
+ <div data-popover id="popover-left" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
320
+ <div class="px-3 py-2 bg-neutral-tertiary border-b border-default rounded-t-base">
321
+ <h3 class="font-medium text-heading">Popover left</h3>
322
+ </div>
323
+ <div class="px-3 py-2">
324
+ <p>And here's some amazing content. It's very engaging. Right?</p>
325
+ </div>
326
+ <div data-popper-arrow></div>
327
+ </div>
328
+ {{< /example >}}
329
+
330
+ ## Triggering
331
+
332
+ Manually set the trigger event by adding the `data-popover-trigger="{hover|click}"` data attribute to the trigger element choosing between a hover or click event. By default it is set to `hover`.
333
+
334
+ {{< example class="flex justify-center space-x-4 pt-32" github="components/popover.md" show_dark=true >}}
335
+ <button data-popover-target="popover-hover" data-popover-trigger="hover" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Hover popover</button>
336
+
337
+ <div data-popover id="popover-hover" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
338
+ <div class="px-3 py-2 bg-neutral-tertiary border-b border-default rounded-t-base">
339
+ <h3 class="font-medium text-heading">Popover left</h3>
340
+ </div>
341
+ <div class="px-3 py-2">
342
+ <p>And here's some amazing content. It's very engaging. Right?</p>
343
+ </div>
344
+ <div data-popper-arrow></div>
345
+ </div>
346
+
347
+ <button data-popover-target="popover-click" data-popover-trigger="click" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Click popover</button>
348
+
349
+ <div data-popover id="popover-click" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
350
+ <div class="px-3 py-2 bg-neutral-tertiary border-b border-default rounded-t-base">
351
+ <h3 class="font-medium text-heading">Popover left</h3>
352
+ </div>
353
+ <div class="px-3 py-2">
354
+ <p>And here's some amazing content. It's very engaging. Right?</p>
355
+ </div>
356
+ <div data-popper-arrow></div>
357
+ </div>
358
+ {{< /example >}}
359
+
360
+ ## Offset
361
+
362
+ Increase or decrease the default offset by adding the `data-popover-offset="{offset}"` data attribute where the value is an integer.
363
+
364
+ {{< example class="flex justify-center pt-32" github="components/popover.md" show_dark=true >}}
365
+ <button data-popover-target="popover-offset" data-popover-offset="30" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Offset popover</button>
366
+
367
+ <div data-popover id="popover-offset" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
368
+ <div class="px-3 py-2 bg-neutral-tertiary border-b border-default rounded-t-base">
369
+ <h3 class="font-medium text-heading">Popover left</h3>
370
+ </div>
371
+ <div class="px-3 py-2">
372
+ <p>And here's some amazing content. It's very engaging. Right?</p>
373
+ </div>
374
+ <div data-popper-arrow></div>
375
+ </div>
376
+ {{< /example >}}
377
+
378
+ ## Animation
379
+
380
+ Customize the animation of the popover component by using the utility classes from Tailwind CSS such as `transition-opacity` and `duration-{x}`.
381
+
382
+ {{< example class="flex justify-center pt-32" github="components/popover.md" show_dark=true >}}
383
+ <button data-popover-target="popover-animation" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Animated popover</button>
384
+
385
+ <div data-popover id="popover-animation" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
386
+ <div class="px-3 py-2 bg-neutral-tertiary border-b border-default rounded-t-base">
387
+ <h3 class="font-medium text-heading">Popover left</h3>
388
+ </div>
389
+ <div class="px-3 py-2">
390
+ <p>And here's some amazing content. It's very engaging. Right?</p>
391
+ </div>
392
+ <div data-popper-arrow></div>
393
+ </div>
394
+ {{< /example >}}
395
+
396
+ ## Disable arrow
397
+
398
+ You can also disable the popover arrow by not including the `data-popper-arrow` element.
399
+
400
+ {{< example class="flex justify-center pt-32" github="components/popover.md" show_dark=true >}}
401
+ <button data-popover-target="popover-no-arrow" type="button" class="text-white bg-brand box-border border border-transparent hover:bg-brand-strong focus:ring-4 focus:ring-brand-medium shadow-xs font-medium leading-5 rounded-base text-sm px-4 py-2.5 focus:outline-none">Default popover</button>
402
+
403
+ <div data-popover id="popover-no-arrow" role="tooltip" class="absolute z-10 invisible inline-block w-64 text-sm text-body transition-opacity duration-300 bg-neutral-primary-soft border border-default rounded-base shadow-xs opacity-0">
404
+ <div class="px-3 py-2 bg-neutral-tertiary border-b border-default rounded-t-base">
405
+ <h3 class="font-medium text-heading">Popover left</h3>
406
+ </div>
407
+ <div class="px-3 py-2">
408
+ <p>And here's some amazing content. It's very engaging. Right?</p>
409
+ </div>
410
+ </div>
411
+ {{< /example >}}
412
+
413
+ ## JavaScript behaviour
414
+
415
+ The Popover API from Flowbite can be used to create an object that will show a pop-up box relative to the main trigger element based on the parameters, options, and methods that you provide.
416
+
417
+ ### Object parameters
418
+
419
+ Create a new Popover object with the object parameters like the trigger element, the popover content element, and extra options to set the placement and offset.
420
+
421
+ <div class="relative my-10 overflow-x-auto shadow-xs rounded-base border border-default">
422
+ <table class="w-full text-sm text-left text-body">
423
+ <thead class="bg-neutral-secondary-soft text-heading">
424
+ <tr class="text-xs font-medium uppercase">
425
+ <th scope="col" class="px-6 py-3">
426
+ Parameter
427
+ </th>
428
+ <th scope="col" class="px-6 py-3">
429
+ Type
430
+ </th>
431
+ <th scope="col" class="px-6 py-3">
432
+ Required
433
+ </th>
434
+ <th scope="col" class="px-6 py-3">
435
+ Description
436
+ </th>
437
+ </tr>
438
+ </thead>
439
+ <tbody>
440
+ <tr class="border-b bg-neutral-primary border-default">
441
+ <td class="px-6 py-4 font-medium">
442
+ <code class="text-fg-brand">targetEl</code>
443
+ </td>
444
+ <td class="px-6 py-4">
445
+ Element
446
+ </td>
447
+ <td class="px-6 py-4">
448
+ Required
449
+ </td>
450
+ <td class="px-6 py-4">
451
+ Set the popover component as the target element.
452
+ </td>
453
+ </tr>
454
+ <tr class="border-b bg-neutral-primary border-default">
455
+ <td class="px-6 py-4 font-medium">
456
+ <code class="text-fg-brand">triggerEl</code>
457
+ </td>
458
+ <td class="px-6 py-4">
459
+ Element
460
+ </td>
461
+ <td class="px-6 py-4">
462
+ Required
463
+ </td>
464
+ <td class="px-6 py-4">
465
+ Set an element to trigger the popover when clicking or hovering (ie. a button, text).
466
+ </td>
467
+ </tr>
468
+ <tr class="border-b bg-neutral-primary border-default">
469
+ <td class="px-6 py-4 font-medium">
470
+ <code class="text-fg-brand">options</code>
471
+ </td>
472
+ <td class="px-6 py-4">
473
+ Object
474
+ </td>
475
+ <td class="px-6 py-4">
476
+ Optional
477
+ </td>
478
+ <td class="px-6 py-4">
479
+ Use the options parameter to set the positioning of the popover element, trigger type, offset, and more.
480
+ </td>
481
+ </tr>
482
+ <tr class="bg-neutral-primary">
483
+ <td class="px-6 py-4 font-medium">
484
+ <code class="text-fg-brand">instanceOptions</code>
485
+ </td>
486
+ <td class="px-6 py-4">
487
+ Object
488
+ </td>
489
+ <td class="px-6 py-4">
490
+ Optional
491
+ </td>
492
+ <td class="px-6 py-4">
493
+ Object of options that allows you to set a custom ID for the instance that is being added to the <a href="https://flowbite.com/docs/getting-started/javascript/#instance-options" class="underline hover:no-underline">Instance Manager</a> and whether to override or not an existing instance.
494
+ </td>
495
+ </tr>
496
+ </tbody>
497
+ </table>
498
+ </div>
499
+
500
+ ### Options
501
+
502
+ Use the following options as the third parameter for the Popover object to set the positioning, offset, and the trigger type (hover or click).
503
+
504
+ <div class="relative my-10 overflow-x-auto shadow-xs rounded-base border border-default">
505
+ <table class="w-full text-sm text-left text-body">
506
+ <thead class="bg-neutral-secondary-soft text-heading">
507
+ <tr class="text-xs font-medium uppercase">
508
+ <th scope="col" class="px-6 py-3">
509
+ Option
510
+ </th>
511
+ <th scope="col" class="px-6 py-3">
512
+ Type
513
+ </th>
514
+ <th scope="col" class="px-6 py-3">
515
+ Description
516
+ </th>
517
+ </tr>
518
+ </thead>
519
+ <tbody>
520
+ <tr class="border-b bg-neutral-primary border-default">
521
+ <td class="px-6 py-4 font-medium">
522
+ <code class="text-fg-brand">placement</code>
523
+ </td>
524
+ <td class="px-6 py-4 font-medium">
525
+ String
526
+ </td>
527
+ <td class="px-6 py-4">
528
+ Set the position of the popover element relative to the trigger element choosing from <code class="text-purple-600 dark:text-purple-400">top|right|bottom|left</code>.
529
+ </td>
530
+ </tr>
531
+ <tr class="border-b bg-neutral-primary border-default">
532
+ <td class="px-6 py-4 font-medium">
533
+ <code class="text-fg-brand">triggerType</code>
534
+ </td>
535
+ <td class="px-6 py-4 font-medium">
536
+ String
537
+ </td>
538
+ <td class="px-6 py-4">
539
+ Set the event type that will trigger the popover content choosing between <code class="text-purple-600 dark:text-purple-400">hover|click|none</code>.
540
+ </td>
541
+ </tr>
542
+ <tr class="border-b bg-neutral-primary border-default">
543
+ <td class="px-6 py-4 font-medium">
544
+ <code class="text-fg-brand">offset</code>
545
+ </td>
546
+ <td class="px-6 py-4 font-medium">
547
+ Integer
548
+ </td>
549
+ <td class="px-6 py-4">
550
+ Set the offset distance between the popover and the trigger element.
551
+ </td>
552
+ </tr>
553
+ <tr class="border-b bg-neutral-primary border-default">
554
+ <td class="px-6 py-4 font-medium">
555
+ <code class="text-fg-brand">onHide</code>
556
+ </td>
557
+ <td class="px-6 py-4 font-medium">
558
+ Function
559
+ </td>
560
+ <td class="px-6 py-4">
561
+ Set a callback function when the popover is hidden.
562
+ </td>
563
+ </tr>
564
+ <tr class="border-b bg-neutral-primary border-default">
565
+ <td class="px-6 py-4 font-medium">
566
+ <code class="text-fg-brand">onShow</code>
567
+ </td>
568
+ <td class="px-6 py-4 font-medium">
569
+ Function
570
+ </td>
571
+ <td class="px-6 py-4">
572
+ Set a callback function when the popover is shown.
573
+ </td>
574
+ </tr>
575
+ <tr class="bg-neutral-primary">
576
+ <td class="px-6 py-4 font-medium">
577
+ <code class="text-fg-brand">onToggle</code>
578
+ </td>
579
+ <td class="px-6 py-4 font-medium">
580
+ Function
581
+ </td>
582
+ <td class="px-6 py-4">
583
+ Set a callback function when the popover visibility has been toggled.
584
+ </td>
585
+ </tr>
586
+ </tbody>
587
+ </table>
588
+ </div>
589
+
590
+ ### Methods
591
+
592
+ Use the methods from the Popover object to programmatically show or hide the popover from directly JavaScript.
593
+
594
+ <div class="relative my-10 overflow-x-auto shadow-xs rounded-base border border-default">
595
+ <table class="w-full text-sm text-left text-body">
596
+ <thead class="bg-neutral-secondary-soft text-heading">
597
+ <tr class="text-xs font-medium uppercase">
598
+ <th scope="col" class="px-6 py-3">
599
+ Method
600
+ </th>
601
+ <th scope="col" class="px-6 py-3">
602
+ Description
603
+ </th>
604
+ </tr>
605
+ </thead>
606
+ <tbody>
607
+ <tr class="border-b bg-neutral-primary border-default">
608
+ <td class="px-6 py-4 font-medium">
609
+ <code class="text-fg-brand">show()</code>
610
+ </td>
611
+ <td class="px-6 py-4">
612
+ Use this method on the Popover object to show the popover content.
613
+ </td>
614
+ </tr>
615
+ <tr class="border-b bg-neutral-primary border-default">
616
+ <td class="px-6 py-4 font-medium">
617
+ <code class="text-fg-brand">hide()</code>
618
+ </td>
619
+ <td class="px-6 py-4">
620
+ Use this method on the Popover object to hide the popover content.
621
+ </td>
622
+ </tr>
623
+ <tr class="border-b bg-neutral-primary border-default">
624
+ <td class="px-6 py-4 font-medium">
625
+ <code class="text-fg-brand">toggle()</code>
626
+ </td>
627
+ <td class="px-6 py-4">
628
+ Use this method on the Popover object to toggle the visibility of the popover content.
629
+ </td>
630
+ </tr>
631
+ <tr class="border-b bg-neutral-primary border-default">
632
+ <td class="px-6 py-4 font-medium">
633
+ <code class="text-fg-brand">isVisible()</code>
634
+ </td>
635
+ <td class="px-6 py-4">
636
+ Use this function to check if the popover is visible or not.
637
+ </td>
638
+ </tr>
639
+ <tr class="border-b bg-neutral-primary border-default">
640
+ <td class="px-6 py-4 font-medium">
641
+ <code class="text-fg-brand">updateOnShow(callback)</code>
642
+ </td>
643
+ <td class="px-6 py-4">
644
+ Use this method to set a custom callback function when the popover has been shown.
645
+ </td>
646
+ </tr>
647
+ <tr class="border-b bg-neutral-primary border-default">
648
+ <td class="px-6 py-4 font-medium">
649
+ <code class="text-fg-brand">updateOnHide(callback)</code>
650
+ </td>
651
+ <td class="px-6 py-4">
652
+ Use this method to set a custom callback function when the popover has been hidden.
653
+ </td>
654
+ </tr>
655
+ <tr class="bg-neutral-primary">
656
+ <td class="px-6 py-4 font-medium">
657
+ <code class="text-fg-brand">updateOnToggle(callback)</code>
658
+ </td>
659
+ <td class="px-6 py-4">
660
+ Use this method to set a custom callback function when the popover has been toggled.
661
+ </td>
662
+ </tr>
663
+ </tbody>
664
+ </table>
665
+ </div>
666
+
667
+ ### Example
668
+
669
+ Use following JavaScript as an example to learn how to initialize, set the options, and use the methods for the Popover object.
670
+
671
+ First of all, set the target element as the popover itself and the trigger element which can be a button or text element.
672
+
673
+ After that you can also set the options object to change the placement and trigger type of the popover, alongside with the callback functions.
674
+
675
+ {{< code lang="javascript" file="popover.js" icon="file" >}}
676
+ // set the popover content element
677
+ const $targetEl = document.getElementById('popoverContent');
678
+
679
+ // set the element that trigger the popover using hover or click
680
+ const $triggerEl = document.getElementById('popoverButton');
681
+
682
+ // options with default values
683
+ const options = {
684
+ placement: 'bottom',
685
+ triggerType: 'hover',
686
+ offset: 10,
687
+ onHide: () => {
688
+ console.log('popover is shown');
689
+ },
690
+ onShow: () => {
691
+ console.log('popover is hidden');
692
+ },
693
+ onToggle: () => {
694
+ console.log('popover is toggled');
695
+ },
696
+ };
697
+
698
+ // instance options object
699
+ const instanceOptions = {
700
+ id: 'popoverContent',
701
+ override: true
702
+ };
703
+ {{< /code >}}
704
+
705
+ Create a new Popover object based on the options above.
706
+
707
+ {{< code lang="javascript" file="popover.js" icon="file" >}}
708
+ import { Popover } from 'flowbite';
709
+
710
+ /*
711
+ * $targetEl: required
712
+ * $triggerEl: required
713
+ * options: optional
714
+ */
715
+ const popover = new Popover($targetEl, $triggerEl, options, instanceOptions);
716
+ {{< /code >}}
717
+
718
+ Use the `show` and `hide` methods on the Popover object to programmatically show and hide the popover element using JavaScript.
719
+
720
+ {{< code lang="javascript" file="popover.js" icon="file" >}}
721
+ // show the popover
722
+ popover.show();
723
+
724
+ // hide the popover
725
+ popover.hide();
726
+
727
+ // toggle the popover
728
+ popover.toggle();
729
+
730
+ // check if popover is visible
731
+ popover.isVisible();
732
+
733
+ // destroy popover object (removes event listeners and off-canvas Popper.js)
734
+ tooltip.destroy();
735
+
736
+ // re-initialize popover object
737
+ tooltip.init();
738
+ {{< /code >}}
739
+
740
+ ### HTML Markup
741
+
742
+ Use the following HTML code for the JavaScript example above.
743
+
744
+ {{< code lang="html" file="popover.html" icon="file" >}}
745
+ <button
746
+ id="popoverButton"
747
+ type="button"
748
+ class="rounded-lg bg-blue-700 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
749
+ Default popover
750
+ </button>
751
+ <div
752
+ data-popover
753
+ id="popoverContent"
754
+ role="tooltip"
755
+ class="invisible absolute z-10 inline-block w-64 rounded-lg border border-gray-200 bg-white text-sm text-gray-500 opacity-0 shadow-xs transition-opacity duration-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400"
756
+ >
757
+ <div
758
+ class="rounded-t-lg border-b border-gray-200 bg-gray-100 px-3 py-2 dark:border-gray-600 dark:bg-gray-700"
759
+ >
760
+ <h3 class="font-semibold text-gray-900 dark:text-white">
761
+ Popover title
762
+ </h3>
763
+ </div>
764
+ <div class="px-3 py-2">
765
+ <p>And here's some amazing content. It's very engaging. Right?</p>
766
+ </div>
767
+ <div data-popper-arrow></div>
768
+ </div>
769
+ {{< /code >}}
770
+
771
+ ### TypeScript
772
+
773
+ If you're using the <a href="{{< ref "getting-started/typescript" >}}">TypeScript configuration</a> from Flowbite then you can import the types for the Popover class, parameters and its options.
774
+
775
+ Here's an example that applies the types from Flowbite to the code above:
776
+
777
+ {{< code lang="typescript" file="popover.ts" icon="file" >}}
778
+ import { Popover } from 'flowbite';
779
+ import type { PopoverOptions, PopoverInterface } from 'flowbite';
780
+ import type { InstanceOptions } from 'flowbite';
781
+
782
+ // set the popover content element
783
+ const $targetEl: HTMLElement = document.getElementById('popoverContent');
784
+
785
+ // set the element that trigger the popover using hover or click
786
+ const $triggerEl: HTMLElement = document.getElementById('popoverButton');
787
+
788
+ // options with default values
789
+ const options: PopoverOptions = {
790
+ placement: 'top',
791
+ triggerType: 'hover',
792
+ offset: 10,
793
+ onHide: () => {
794
+ console.log('popover is shown');
795
+ },
796
+ onShow: () => {
797
+ console.log('popover is hidden');
798
+ },
799
+ onToggle: () => {
800
+ console.log('popover is toggled');
801
+ },
802
+ };
803
+
804
+ // instance options object
805
+ const instanceOptions: InstanceOptions = {
806
+ id: 'popoverContent',
807
+ override: true
808
+ };
809
+
810
+ if ($targetEl) {
811
+ /*
812
+ * targetEl: required
813
+ * triggerEl: required
814
+ * options: optional
815
+ * instanceOptions: optional
816
+ */
817
+ const popover: PopoverInterface = new Popover(
818
+ $targetEl,
819
+ $triggerEl,
820
+ options,
821
+ instanceOptions
822
+ );
823
+
824
+ popover.show();
825
+ }
826
+ {{< /code >}}