LogoLogo
Quest HomeSign Up
  • 😀Welcome to Quest
  • Getting Started
    • Quest Overview
    • Helpful Resources
    • Quick Start - Build your first component from Figma
    • Quick Start - Build your first component from a Wireframe
    • AI Prompt
  • Fundamentals
    • Customizing & Using the UI Kit
    • Designing Custom Components in Figma
    • Easily Sync Designs without Losing Work
    • Setting Up Props & Bindings
    • Exporting Code
    • Push to your Repository
    • Creating Responsive Components
    • Nesting Components
    • Workspaces & Apps
    • Code & Preview Mode
    • Prototypes/Wireframes
    • Animations - build with React Spring
    • Quest plugin for Figma Dev Mode
    • Publish on Quest to a URL
  • Features
    • Working with Variants & States
    • Naming Conventions
    • Previewing with Custom Fonts
    • Light & Dark Mode
    • Creating a custom Tooltip
    • Creating a Floating Popover
    • Creating a Dialog pop-up
    • Radio Group
    • Using the MUI Data Grid & Table
    • Data & List Bindings
    • Dynamic Bindings
    • Grid
    • File Upload
    • Design System Tab and Theme Import
    • How-to use a Theme in your Application
    • Accessibility Support
    • Design Tips and Tricks
    • Video
    • Lazy Loading
    • Sticky Position
    • Link
    • Custom Breakpoints
    • Min / Max Width
    • Supported Quest UI Kit Components & How-to Make Edits in Figma
    • Supported Chakra Components & How-to Make Edits in Figma
  • Advanced Tutorials
    • Setting up Bindings and Features on the MUI Button
    • Display Repeating Components based on a Dynamic List
    • How-to Pass Values from Parent to Nested Components
    • How-to Invoke a modal Dialog Box from a Button Click
    • How to Setup a popover
  • 🔍Help
    • Product Updates
    • FAQs
    • Plugin Warnings / Alerts
  • 💡Support
    • Why does my design look different in Quest than Figma?
    • Can I keep making changes in Figma without affecting code?
    • What are some best practices?
    • Does Quest support more than Figma and React?
    • How do I manage users?
    • What is the refund process?
    • How do I get in touch with Quest?
    • Do I have to use MUI if I'm using Quest?
Powered by GitBook
On this page

Was this helpful?

  1. Advanced Tutorials

How-to Invoke a modal Dialog Box from a Button Click

PreviousHow-to Pass Values from Parent to Nested ComponentsNextHow to Setup a popover

Last updated 1 year ago

Was this helpful?

Use case: Display a modal dialog box based on a user action such as button click, etc.

Steps:

  1. Create a Figma component with the below layout. You can use any of the form samples we have in the to get started or you can design your own.

  2. Export the components to Quest. Within the Quest editor, select the Contact Us frame layer in the left side panel and set the Dialog Feature as shown below.

  3. Add the onClick binding on the Contact Us button

  4. Select the ContactUs form and pass the Nested Prop Values as below:

  5. Open the ContactUs form in the Quest editor and add the below two props: open and onClose

  6. Add the Visible binding to the top frame of ContactUs to control the visibility. Set the visible binding to props.open

  7. Add the onClick binding to the SUBMIT button:

  8. Download the code and add the below logic to the use hook file:

    import React from 'react';
    const useDialogSample = () => {
      const [isDialogOpen, setIsDialogOpen] = React.useState(false);
    
      let data: any = {isDialogOpen};
      const toggleDialog = (): any => {
        setIsDialogOpen(!isDialogOpen);
      };
    
      let fns: any = { toggleDialog };
    
      return { data, fns };
    };
    
    export default useDialogSample;
  9. Download and run the app (npm i, npm start or npm run dev). You will see the below when you click the CONTACT US button:

Quest Component library