vue-modal
react-useportal
vue-modal | react-useportal | |
---|---|---|
2 | 3 | |
128 | 889 | |
- | - | |
8.5 | 1.2 | |
3 months ago | 7 months ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
vue-modal
-
Vue Modal Router
Everything I wrote was programmed and put into a separate library jenesius-vue-modal.
-
# A new look at modals in vue 3
from HTML. We will talk about modal windows in the vue ecosystem. Codes and the implementation can be viewed here jenesius-vue-modal. The new teleport feature in the third version of vue allows you to move content to the location you need. And that's cool! Maybe. having tried to use it on my project, my team encountered the following problems: how to support such code when any component can insert something anywhere in your product. We added abstractions, new components that were only used to limit the use of teleport. We used a lot of modal windows in our project. Open one, open another on top, return value from modal, integrate modal window in vue-router is not a complete list of what we implemented. At first we used a cool library, but like this the approach irritated our entire team: :user-id = "id" v-if = "isActive"/> Enter fullscreen mode Exit fullscreen mode For us, It looked awkward and we really wanted to get rid of it. We wanted to get rid of the description of the modal components windows in another component. Our task was to make modal windows to another level, another layer. In vue it is very convenient to use reactive states based on ref/reactive. Add a queue that will store open modal windows: const modalQueue = reactive([]); Enter fullscreen mode Exit fullscreen mode When adding a modal window, we will write the value there, when removing - delete. Everything seems to be very simple. Now to open a modal window add the openModal method: function openModal(component, props) { modalQueue.push({component, props}); } Enter fullscreen mode Exit fullscreen mode To close we use the splice method. Now all that remains is to display the modal windows. Let's create a separate one for this component in which the transferred components will be displayed. Also don't forget to pass props there: v-for = "item in modalQueue" :is = "item.component" v-bind = "item.props" /> Enter fullscreen mode Exit fullscreen mode To open a modal window from our new user card, let's add a click handler and call a new function: @click = "showUserModal">open template> const props = defineProps(['userId']) function showUserModal() { openModal(ModalUser, { userId: props.modalId }) } script> Enter fullscreen mode Exit fullscreen mode also, we must connect this component to App.vue. This is just a short but main part of what we have implemented. For us this approach allows you to build interfaces more accurately and safely. The entire code base can be found in the public repository at GitHub. We tried to give examples on how to use this library. We also described instructions and made nice documentation.
react-useportal
-
React use portal
I'm looking for ideas on how to create a usePortal hook myself. So far I've found two libraries: https://github.com/wellyshen/react-cool-portal https://github.com/alex-cory/react-useportal
-
Awesome Things Related To React Hooks π
react-useportal - π React hook for Portals
-
Top 10 React Hooks Library
usePortal hooks allow creation of elements outside the DOM hierarchy of the Application. usePortal widely used having dropdowns, notification popups, modals, tooltips. usePortal works with Server Side Rendering (SSR) as it is isomorphic. usePortal written in TypeScript. It allows customization of portal styling and many more options.
What are some alternatives?
react-native-actions-sheet - A Cross Platform(Android, iOS & Web) ActionSheet with a flexible api, native performance and zero dependency code for react native. Create anything you want inside ActionSheet.
use-http - πΆ React hook for making isomorphic http requests
vuejs-confirm-dialog - Makes simple to create, reuse, promisify and build chains of modal dialogs in Vue.js
nice-modal-react - A modal state manager for React.
SweetAlert - A beautiful replacement for JavaScript's "alert"
constate - React Context + State
keukenhof - Lightweight and easy to use the library for modals
react-portal - π― React component for transportation of modals, lightboxes, loading bars... to document.body or else.
react-spring-bottom-sheet - Accessible βΏοΈ, Delightful β¨, & Fast π
react-slick - React carousel component
react-native-portal - A simplified portal implementation for βοΈ React Native & Web βοΈ.
react-layer-stack - Layering system for React. Useful for popover/modals/tooltip/dnd application