-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
If you don't want to complicate yourselves with Fonts/SVGs or icon components, if you are using Vite ⚡️, there is this awesome plugin based on Iconify you can use, it's ridiculously easy.
// Same implementation as https://github.com/vueuse/vueuse/blob/main/packages/core/onClickOutside/index.ts import { watch, unref, onUnmounted } from 'vue'; const EVENTS = ['mousedown', 'touchstart', 'pointerdown']; function unrefElement(elRef) { return unref(elRef)?.$el ?? unref(elRef); } function useEventListener(...args) { let target; let event; let listener; let options; [target, event, listener, options] = args; if (!target) return; let cleanup = () => {}; watch( () => unref(target), el => { cleanup(); if (!el) return; el.addEventListener(event, listener, options); cleanup = () => { el.removeEventListener(event, listener, options); cleanup = noop; }; }, { immediate: true }, ); onUnmounted(stop); return stop; } export default function useClickOutside() { function onClickOutside(target, callback) { const listener = event => { const el = unrefElement(target); if (!el) return; if (el === event.target || event.composedPath().includes(el)) return; callback(event); }; let disposables = EVENTS.map(event => useEventListener(window, event, listener, { passive: true }), ); const stop = () => { disposables.forEach(stop => stop()); disposables = []; }; onUnmounted(stop); return stop; } return { onClickOutside, }; }
View on GitHub
In this tutorial, we're going to cover step by step how to implement a modal dialog with this feature and styling it with my favorite utility framework TailwindCSS along with:
Related posts
-
Creating a dropdown menu using Vue3 and PopperJS
-
🎉Introducing Atomic Design in Vue.js🔥
-
The one with styling Zag.js components with Tailwind CSS
-
Crafting my Portfolio - Nav and Footer
-
Any UI framework for Vue that isn't so opinionated it can't be customized? - Also, what's it like working with your preferred framework?