-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Programmatic modal #285
Comments
This could be nice indeed, there is something we could do with https://vueuse.org/core/createTemplatePromise/, I'll look into it! |
requested a similar feature confirmations |
I think we could replace HeadlessUI Dialog with vue-final-modal Added benefits in addition to providing a Styleless component
What do you think? |
I'd rather implement the |
Vue-final-modal is also a good option, but I agree with @benjamincanac: his option may be more customizable and may offer better availability for people with limited accessibility. |
I'm interested in contributing to this, following @benjamincanac 's recommendation. I'd have a few questions regarding the implementation, and what I have in mind: I believe OP expects an API like this (types are fictives, I don't know the exact ones but interested to know them): interface UseModalControls {
// Optional modal component param would allow chaining Modals
reveal: (modalComponent?: Component) => Promise<void>
hide: () => Promise<void>
isOpen: Ref<boolean>
}
function useModal<T extends Component>(modalComponent: T, props: ComponentProps<T>, modalLifeCycleOptions?: ModalLifeCycleOptions): UseModalControls {}
// modalLifeCycleOptions -> onReveal, onClose ... Dealing with this composable across multiple components means that we need to persist the state of the current configured modal (selected component, open/close state...). -> Should we use inject/provide (with createInjectionState() or createSharedComposable() for example) to provide the state at the root level when installing the module, and inject in the composable so it is aware of the current state ? |
Programmatic modal usage like accept dialog (yes/no)
The text was updated successfully, but these errors were encountered: