A Pen by Constantin on CodePen.
Created
April 14, 2020 20:42
-
-
Save nraloux/fd6406a286053c22497026dc255c3234 to your computer and use it in GitHub Desktop.
Hamburger Menu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<main | |
class="mx-auto max-w-4xl bg-gray-200 h-screen" | |
x-data="{ 'isDialogOpen': false }" | |
@keydown.escape="isDialogOpen = false" | |
> | |
<nav class="p-4 bg-indigo-700 text-indigo-100"> | |
<div>Hamburger Menu</div> | |
<div class="text-xs text-indigo-400 font-thin">Alpine.js + TailwindCSS</div> | |
</nav> | |
<section class="flex flex-wrap p-4"> | |
<table class="w-full"> | |
<thead> | |
<tr class="border-b"> | |
<th class="p-2 text-left">Name</th> | |
<th class="p-2 text-left">Email</th> | |
<th class="p-2 text-right"></th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr class="hover:bg-yellow-100"> | |
<td class="p-2 text-left flex flex-col"> | |
John Bob | |
</td> | |
<td class="p-2 text-left"> | |
[email protected] | |
</td> | |
<td class="text-right" x-data="{ 'isHamburgerOpen': false }"> | |
<button | |
type="button" | |
title="Open the actions menu" | |
class="font-mono text-2xl px-2" | |
@click="isHamburgerOpen = true" | |
:class="{ 'bg-gray-100': isHamburgerOpen }" | |
> | |
⋯ | |
</button> | |
<ul | |
x-show="isHamburgerOpen" | |
x-cloak | |
@click.away="isHamburgerOpen = false" | |
class="absolute border bg-white shadow-md text-left -mt-10 -ml-12" | |
> | |
<li class="p-2 hover:bg-gray-200">β Edit</li> | |
<li class="p-2 hover:bg-gray-200">β Delete</li> | |
<li class="p-2 hover:bg-gray-200">π¦ Other action</li> | |
</ul> | |
</td> | |
</tr> | |
<tr class="hover:bg-yellow-100"> | |
<td class="p-2 text-left flex flex-col"> | |
Joan Bab | |
</td> | |
<td class="p-2 text-left"> | |
[email protected] | |
</td> | |
<td class="text-right" x-data="{ 'isHamburgerOpen': false }"> | |
<button | |
type="button" | |
title="Open the actions menu" | |
class="font-mono text-2xl px-2" | |
@click="isHamburgerOpen = true" | |
:class="{ 'bg-gray-100': isHamburgerOpen }" | |
> | |
⋯ | |
</button> | |
<ul | |
x-show="isHamburgerOpen" | |
x-cloak | |
@click.away="isHamburgerOpen = false" | |
class="absolute border bg-white shadow-md text-left -mt-10 -ml-12" | |
> | |
<li class="p-2 hover:bg-gray-200">β Edit</li> | |
<li class="p-2 hover:bg-gray-200">β Delete</li> | |
<li class="p-2 hover:bg-gray-200">π¦ Other action</li> | |
</ul> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</section> | |
</main> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* what js? */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* CSS handled by Tailwind π */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/1.1.4/tailwind.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment