An interactive menu that opens to the bottom of a button using Svelte and Tailwind CSS.
For this component to properly work, you will need to install popper.js into your project. Please run the following:
npm i -E @popperjs/[email protected]
Dropdown Example
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-gray-800 active:bg-gray-900 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
white Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-white text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-gray-800" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-gray-800" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-gray-800" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-gray-800" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-blueGray-500 active:bg-blueGray-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
blueGray Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-blueGray-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-red-500 active:bg-red-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
red Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-red-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-orange-500 active:bg-orange-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
orange Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-orange-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-amber-500 active:bg-amber-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
amber Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-amber-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-emerald-500 active:bg-emerald-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
emerald Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-emerald-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-teal-500 active:bg-teal-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
teal Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-teal-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-lightBlue-500 active:bg-lightBlue-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
lightBlue Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-lightBlue-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-indigo-500 active:bg-indigo-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
indigo Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-indigo-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-purple-500 active:bg-purple-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
purple Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-purple-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " bottom-start " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-pink-500 active:bg-pink-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
pink Dropdown
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-pink-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
Dropup Example
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-gray-800 active:bg-gray-900 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
white Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-white text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-gray-800" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-gray-800" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-gray-800" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-gray-800" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-blueGray-500 active:bg-blueGray-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
blueGray Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-blueGray-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-red-500 active:bg-red-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
red Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-red-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-orange-500 active:bg-orange-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
orange Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-orange-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-amber-500 active:bg-amber-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
amber Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-amber-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-emerald-500 active:bg-emerald-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
emerald Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-emerald-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-teal-500 active:bg-teal-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
teal Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-teal-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-lightBlue-500 active:bg-lightBlue-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
lightBlue Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-lightBlue-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-indigo-500 active:bg-indigo-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
indigo Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-indigo-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-purple-500 active:bg-purple-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
purple Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-purple-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
<script>
// library for creating dropdown menu appear on click
import { createPopper } from " @popperjs/core " ;
// core components
let dropdownPopoverShow = false ;
let btnDropdownRef ;
let popoverDropdownRef ;
const toggleDropdown = () => {
if ( dropdownPopoverShow ) {
dropdownPopoverShow = false ;
} else {
dropdownPopoverShow = true ;
createPopper ( btnDropdownRef , popoverDropdownRef , {
placement : " top " ,
});
}
};
</script>
<div class= "flex flex-wrap" >
<div class= "w-full sm:w-6/12 md:w-4/12 px-4" >
<div class= "relative inline-flex align-middle w-full" >
<button class= "text-white font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 bg-pink-500 active:bg-pink-600 ease-linear transition-all duration-150" type= "button" bind:this= "{btnDropdownRef}"
on:click= "{toggleDropdown}" >
pink Dropup
</button>
<div bind:this= "{popoverDropdownRef}" class= "bg-pink-500 text-base z-50 float-left py-2 list-none text-left rounded shadow-lg mt-1 min-w-48 {dropdownPopoverShow ? 'block':'hidden'}" >
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Another action
</a>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Something else here
</a>
<div class= "h-0 my-2 border border-solid border-t-0 border-blueGray-800 opacity-25" ></div>
<a href= "#pablo" class= "text-sm py-2 px-4 font-normal block w-full whitespace-no-wrap bg-transparent text-white" >
Seprated link
</a>
</div>
</div>
</div>
</div>
Props
Please check the official PopperJS Documentation .
You can also check the Official PopperJS Github Repository .