-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
144951f
commit 1166eb0
Showing
2 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
packages/@headlessui-vue/examples/src/components/popover/popover.vue
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<template> | ||
<div class="flex justify-center items-center space-x-12 p-12"> | ||
<button>Previous</button> | ||
|
||
<PopoverGroup as="nav" ar-label="Mythical University" class="flex space-x-3"> | ||
<Popover as="div" class="relative" v-slot="{ open }"> | ||
<PopoverButton | ||
class="px-3 py-2 bg-gray-300 border-2 border-transparent focus:outline-none focus:border-blue-900" | ||
>Normal</PopoverButton | ||
> | ||
<PopoverPanel class="absolute flex flex-col w-64 bg-gray-100 border-2 border-blue-900"> | ||
<a | ||
v-for="(link, i) of links" | ||
:hidden="i === 2" | ||
href="/" | ||
class="px-3 py-2 border-2 border-transparent hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:border-blue-900" | ||
> | ||
Normal - {{ link }} | ||
</a> | ||
</PopoverPanel> | ||
</Popover> | ||
|
||
<Popover as="div" class="relative"> | ||
<PopoverButton | ||
class="px-3 py-2 bg-gray-300 border-2 border-transparent focus:outline-none focus:border-blue-900" | ||
>Focus</PopoverButton | ||
> | ||
<PopoverPanel | ||
focus | ||
class="absolute flex flex-col w-64 bg-gray-100 border-2 border-blue-900" | ||
> | ||
<a | ||
v-for="(link, i) of links" | ||
href="/" | ||
class="px-3 py-2 border-2 border-transparent hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:border-blue-900" | ||
> | ||
Focus - {{ link }} | ||
</a> | ||
</PopoverPanel> | ||
</Popover> | ||
|
||
<Popover as="div" class="relative"> | ||
<PopoverButton | ||
class="px-3 py-2 bg-gray-300 border-2 border-transparent focus:outline-none focus:border-blue-900" | ||
>Portal</PopoverButton | ||
> | ||
<Portal> | ||
<PopoverPanel class="flex flex-col w-64 bg-gray-100 border-2 border-blue-900"> | ||
<a | ||
v-for="(link, i) of links" | ||
href="/" | ||
class="px-3 py-2 border-2 border-transparent hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:border-blue-900" | ||
> | ||
Portal - {{ link }} | ||
</a> | ||
</PopoverPanel> | ||
</Portal> | ||
</Popover> | ||
|
||
<Popover as="div" class="relative"> | ||
<PopoverButton | ||
class="px-3 py-2 bg-gray-300 border-2 border-transparent focus:outline-none focus:border-blue-900" | ||
>Focus in portal</PopoverButton | ||
> | ||
<Portal> | ||
<PopoverPanel focus class="flex flex-col w-64 bg-gray-100 border-2 border-blue-900"> | ||
<a | ||
v-for="(link, i) of links" | ||
href="/" | ||
class="px-3 py-2 border-2 border-transparent hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:border-blue-900" | ||
> | ||
Focus in Portal - {{ link }} | ||
</a> | ||
</PopoverPanel> | ||
</Portal> | ||
</Popover> | ||
</PopoverGroup> | ||
|
||
<button>Next</button> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { defineComponent } from 'vue' | ||
import { Popover, PopoverOverlay, PopoverPanel, PopoverGroup, PopoverButton } from '@headlessui/vue' | ||
function html(templates) { | ||
return templates.join('') | ||
} | ||
export default { | ||
components: { | ||
Popover, | ||
PopoverPanel, | ||
PopoverOverlay, | ||
PopoverGroup, | ||
PopoverButton, | ||
}, | ||
setup() { | ||
let links = ['First', 'Second', 'Third', 'Fourth'] | ||
return { links } | ||
}, | ||
} | ||
</script> |
This file contains 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