Modal in desktop, fullscreen in mobile

Overview

React Full Screen Modal

Why?

Modals typically don't work well for modals. They take up a lot of space and often squish their contents.

This library aims to solve that by turning the modal into full screen after a certain break point.

Goals

  1. Do one thing - Modal on desktop, full screen on mobile
  2. Do what you want - Outside of basic animations and modal utilities, this does nothing more and nothing less than Goal #1
  3. Simple API

Demo

Demo

Props

  • isOpen: boolean - Determines whether the modal is open. *
  • children: React.ReactNode - Children components of modal. *
  • overlay: boolean - Determines whether or not to have a background overlay for desktop modal. Default: true
  • breakpoint: number - Width of screen at which to switch between modal and full screen. Default: 350
  • outsideClick: (event: MouseEvent) => void - On click that fires when a use clicks outside of the modal (best used to close modal). Default: noop
  • mobileStyles: React.CSSProperties - Css styles to pass to mobile full screen wrapper.
  • desktopStyles: { modal: ReactCSSProperties, overlay: React.CSSProperties } - Object that contains two properties of css styles to pass to the modal or overlay components.

* Required props

Example

export const Test1 = () => {
  const [isOpen, setIsOpen] = useState(false)

  return (
    <>
      <button onClick={() => setIsOpen((o) => !o)}>Open modal</button>
      <Modal
        isOpen={isOpen}
        outsideClick={() => {
          setIsOpen(false)
        }}
      >
        <div style={{ height: 200, width: 330, padding: 10 }}>
          Test
          <button onClick={() => setIsOpen(false)}>close</button>
        </div>
      </Modal>
    </>
  )
}
You might also like...

Recipe providing mobile app, User selects ingredients in pantry and is then provided recipes for those ingredients. App contains a signup/login, meal planner and grocery list pages.

Recipog Student Information Name Connor de Bruyn Username Destiro Assignment SWEN325 A2 Description “Recipog” is a recipe providing app that allows th

Dec 26, 2021

Fetching data from REST COUNTRIES API, this app (mobile version for now) gives information like area, population, capital, and borders for 195 countries from seven continents.

Fetching data from REST COUNTRIES API, this app (mobile version for now) gives information like area, population, capital, and borders for 195 countries from seven continents.

Space Travellers' Hub World Countries App works with an API which returns informations about 195 countries. Fetching data from REST COUNTRIES API, thi

Aug 8, 2022

🚀 Aplicação mobile com React Native produzida durante o Next Level Week #05

🚀 Aplicação mobile com React Native produzida durante o Next Level Week #05

✨ Tecnologias Esse projeto foi desenvolvido com as seguintes tecnologias: React Native Typescript Expo 💻 Projeto Aplicativo para lhe ajudar a lembrar

May 28, 2022

USA Covid-19 Tracker is a mobile-first application built with React and Redux to give precise information about the virus behavior in the United States. Great transitions and user feedback made with plain CSS.

USA Covid-19 Tracker is a mobile-first application built with React and Redux to give precise information about the virus behavior in the United States. Great transitions and user feedback made with plain CSS.

React.js USA Covid-19 Tracker This application allows the public to keep track of the stadistics of the Covid-19 Pandemic in the United Stated. You wi

Oct 25, 2022

Choosy is a mobile application that allows users to create photo polls that others can vote on and help declare which photo is the best.

Choosy is a mobile application that allows users to create photo polls that others can vote on and help declare which photo is the best.

Choosy - Create photo polls The freshest mobile application for your photo polls! Explore the docs » Table of Contents Introduction App concept Target

Sep 7, 2022

Concircle scanner mobile app is application That helps you scan your order and position and to know if there are exact or not. it's cross-platform app.

Concircle scanner mobile app is application That helps you scan your order and position and to know if there are exact or not. it's cross-platform app.

Concircle scanner mobile app ⭐ Star on GitHub — it motivates Me a lot! Concircle scanner mobile app is application That helps you scan your order and

May 7, 2022

Course material for Mobile Application Development, Integrated Digital Media, Tandon School of Engineering, NYU

Mobile-Application-Development Course material for Mobile Application Development, Integrated Digital Media, Tandon School of Engineering, NYU Classs

May 1, 2022

This project is a React Native Boilerplate that can be used to kickstart a mobile app.

Meta Point People: Mounir Dhahri This is an Artsy OSS project. Don't know what Artsy is? Check out this overview and more, or read our objc.io on team

Jul 6, 2022

Aplicativo mobile desenvolvido para o FF-Hackathon.

Aplicativo mobile desenvolvido para o FF-Hackathon.

✔️ AllTo - FF Hacka | Shawee ✔️ FF Hacka | Project | Technologies | How to use | License ℹ️ What's FF Hacka? Hackatons são eventos que envolvem tecnol

Jun 17, 2022
Owner
Chris
cmd c + cmd v
Chris
Mobile app development framework and SDK using HTML5 and JavaScript. Create beautiful and performant cross-platform mobile apps. Based on Web Components, and provides bindings for Angular 1, 2, React and Vue.js.

Onsen UI - Cross-Platform Hybrid App and PWA Framework Onsen UI is an open source framework that makes it easy to create native-feeling Progressive We

null 8.7k Jan 8, 2023
WPPConnect/mobile is an open source project with the objective of automating whatsapp web using the android or ios mobile browser and being able to perform all the functions of our wa-js project

WPPConnect/mobile is an open source project with the objective of automating whatsapp web using the android or ios mobile browser and being able to perform all the functions of our wa-js project, so it is possible to create a customer service, media sending, intelligence recognition based on artificial phrases and many other things, use your imagination to change and modify this project or collaborate on improvements...

null 11 Dec 28, 2022
Rocket Bank is a finance mobile app built for XP Mobile Challenge.

Rocket Bank is a mobile application made with React Native. You can track your portfolio performance, make deposits and withdrawals, and buy and sell

Rafo 10 Jul 27, 2022
Accessible modal dialog component for React

react-modal Accessible modal dialog component for React.JS Table of Contents Installation API documentation Examples Demos Installation To install, yo

React Community 7.1k Jan 1, 2023
A very lightweight and flexible accessible modal dialog script.

A11y Dialog This is a lightweight (1.3Kb) yet flexible script to create accessible dialog windows. Documentation ↗ Demo on CodeSandbox ↗ Features: Clo

Kitty Giraudel 2.1k Jan 2, 2023
A desktop app optimized for people to play web-based incremental game

plaza-app A desktop app optimized for people to play web-based incremental game Setup yarn to install dependencies Local testing yarn start to open lo

null 2 Dec 24, 2022
Most modern mobile touch slider with hardware accelerated transitions

Get Started | Documentation | Demos Swiper Swiper - is the free and most modern mobile touch slider with hardware accelerated transitions and amazing

Vladimir Kharlampidi 33.7k Jan 5, 2023
An easily internationalizable, mobile-friendly datepicker library for the web

react-dates An easily internationalizable, accessible, mobile-friendly datepicker library for the web. Live Playground For examples of the datepicker

Airbnb 12k Dec 30, 2022
Our Expo-based mobile application for demonstration purposes.

Capable Care reference implementation This repository provides a working example of a React Native mobile application (built on Expo) integrating Capa

Capable Health 11 Oct 1, 2022
Final Project 3 - Mobile App Hotel Reservation

Hotel Reservation Mobile App Instruksi Pada Final Project kali ini, kamu diminta untuk membuat cloning dari aplikasi Airbnb, khusus untuk fitur-fitur

Akhsan Bayu 2 Jan 3, 2022