Comments (10)
Now support the dialog in v0.11, can see the docs Dialog mode to use it, open a new issue if you have any problems.
And the demo has the example of dialog.
from headlessui-float.
Hi @WesleyKapow, I think the Headless UI Float is not made for Dialog (Modal); could you please explain how you intend to use both Dialog and Headless UI Float?
from headlessui-float.
In the same way it is used for Popover
it'd be nice if it could also be used with headless Dialog
.
from headlessui-float.
@WesleyKapow Can you please describe what kind of function you want to develop that will be used in this way?😅 and provide some sample code or screenshots.
from headlessui-float.
@ycs77 We are in the same situation. Dialog is controlled while Popover is not, so there is a case you may need it to emulate "Popover" with Dialog. Similar to Radix Popover:
https://www.radix-ui.com/docs/primitives/components/popover
from headlessui-float.
https://headlessui-float.vercel.app/vue/other-options.html shows how to use Float
with a headless Menu
. I'd like to do the same but for a headless Dialog
. I need this in order to control the position of a Dialog
. For now, I ended up using https://floating-ui.com/ directly to control the position of my headless Dialog
.
from headlessui-float.
@WesleyKapow you need to understand menu and popover elements are positioned against a parent element (button or menu-item), that is why you can use float-ui to position the child elements around the parent element.
A Dialog or modal is just a popup inside a container. You don't need float-ui to position the dialog.
Vue example for Dialog:
<script setup>
import { ref } from 'vue'
import { Dialog, DialogPanel, DialogTitle, TransitionChild, TransitionRoot } from '@headlessui/vue'
const open = ref(true)
</script>
<template>
<TransitionRoot as="template" :show="open">
<Dialog as="div" class="relative z-10" @close="open = false">
<TransitionChild as="template" enter="ease-out duration-300" enter-from="opacity-0" enter-to="opacity-100" leave="ease-in duration-200" leave-from="opacity-100" leave-to="opacity-0">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" />
</TransitionChild>
<div class="fixed inset-0 z-10 overflow-y-auto">
<div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<TransitionChild as="template" enter="ease-out duration-300" enter-from="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" enter-to="opacity-100 translate-y-0 sm:scale-100" leave="ease-in duration-200" leave-from="opacity-100 translate-y-0 sm:scale-100" leave-to="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95">
<DialogPanel class="relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-sm sm:p-6">
<div class="mt-3 text-center sm:mt-5">
<DialogTitle as="h3" class="text-lg font-medium leading-6 text-gray-900">Payment successful</DialogTitle>
<div class="mt-2">
<p class="text-sm text-gray-500">Lorem ipsum dolor sit amet consectetur adipisicing elit. Consequatur amet labore.</p>
</div>
</div>
<div class="mt-5 sm:mt-6">
<button type="button" class="inline-flex w-full justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:text-sm" @click="open = false">Go back to dashboard</button>
</div>
</DialogPanel>
</TransitionChild>
</div>
</div>
</Dialog>
</TransitionRoot>
</template>
Just change the classes to position the dialog. No need for another package when using a Dialog.
from headlessui-float.
Ok, I have some ideas to support Dialog, but it will take a while.
from headlessui-float.
Just an FYI, I did end up using floating-ui directly in this case and not using headlessui-float.
from headlessui-float.
Just an FYI, I did end up using floating-ui directly in this case and not using headlessui-float.
Of course, floating-ui can be manipulated more freely than headlessui-float.
from headlessui-float.
Related Issues (20)
- Popover with overlay HOT 1
- React: headlessUi panels property unmount={false} not working HOT 2
- Vue refs not working inside `<Float>`? HOT 8
- Visible flicker when selecting an option in Listbox wrapped in Float HOT 3
- tailwindcssOriginClass not works when tailwindcss prefix is applied in config file. HOT 1
- OriginClassResolver not properly works in rtl direction. HOT 3
- Popover inside a portal doesn't get keyboard focus HOT 2
- height HOT 2
- `onHide` is called every time the component is rendered HOT 3
- FloatContextMenu throws error in Nuxt 3 HOT 2
- Could not find a declaration file for module HOT 2
- Make a mode where the transform origin is based on the arrow position HOT 1
- Can't make Vue dropdown options stick to the Combobox width HOT 2
- Error: Did you forget to passthrough the `ref` to the actual DOM node? when content is in separate component HOT 2
- Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element' HOT 2
- `hide()` feature of Floating UI HOT 2
- With Two Portalled components, neither work HOT 3
- Pass custom `root` to `<Float>` HOT 3
- [React] Error when using Popover HOT 1
- Browser scrolls up when opening a listbox HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from headlessui-float.