Use our Tailwind CSS Popover to portray people or objects. It can be used as a visual identifier for a user profile on your website.
See below our popover component examples.
You can initialize a new popover by adding the data-popover-target=" data attribute to the trigger element and the {popoverName}"data-popover=" to the element that you want to use as the popover.{popoverName}"
You can change the position of the popover relative to it's trigger element by adding the data-popover-placement=" data attribute to the popover element by default it set's to {top}"top.
Check the placement values for popover here.
You can modify the open/close state animation for popover by adding the data-popover-mount=", {opacity-100}"data-popover-unmount=" and {opacity-0}"data-popover-transition=" data attributes to the popover element. You can pass tailwind css classnames for those data attributes for animation the popover. {transition-opacity}"
Check more about animation data attributes for popover here.
Tania Andrew • @canwu
Frontend Developer • Major interest in Web Development: motivated to achieve measurable results, to deepen my knowledge and improve my skills.
United Kingdom
Material Tailwind@material-tailwind is an easy-to-use components library htmlFor Tailwind CSS and Material Design.
TypeScript
1,480
Veritied
The following data attributes are available for popover trigger element.
| Attribute | Description |
|---|---|
data-popover-target | Set the popover target element, it should be the same as the data-popover data attribute. |
data-popover-nested | Set it to true if you want to use one popover inside another popover. |
The following data attributes are available for popover element.
| Attribute | Description | Default |
|---|---|---|
data-popover | Set the name of the popover and reference it to the popover trigger element. | |
data-popover-offset | Set the offset between the popover and the popover trigger element. | 5 |
data-popover-placement | Set the position of the popover relative to it's trigger element. | top |
data-popover-mount | Set the classnaes that should be used when the popover is visible. | opacity-1 |
data-popover-unmount | Set the classnaes that should be used when the popover is hidden. | opacity-0pointer-events-none |
data-popover-transition | Set the classnaes that should be used for transition of the popover. | transition-opacityduration-300 |
The popover component needs a required script file to work, you just need to add the below script file to the bottom of your html file.
<!-- from node_modules -->
<script
type="module"
src="node_modules/@material-tailwind/html@latest/scripts/popover.js"
></script>
<!-- from cdn -->
<script
type="module"
src="https://unpkg.com/@material-tailwind/html@latest/scripts/popover.js"
></script>