Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
Open Modal in fullscreen

Is there a way to open a modal which will take entire screen just like in youtube video when you click on it's fullscreen it takes the entire screen view.

Right now this is what i have achieved so far

<Modal
      title={false}
      visible={visible}
      footer={false}
      centered
      width="100vw"
      onCancel={() => setVisible(false)}
    >
      <div style={{height: '100vh'}}>
        some content
      </div>
    </Modal>

and this is how it looks like

enter image description here

i want it to look like this

enter image description here

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

With pure JavaScript you can do something like

const modal = document.querySelector('#myModalsClass')
modal.requestFullscreen()

If you look up the docs for the fullscreen API you will find other useful information about how to work with this.

If you're using React you need to use a ref to access the dom api

import React, { useRef } from "react";

const MyComponent = (props) => {
  const myFullscreenComponent = useRef();
  const openContentFullscreen = () => {
    const element = myFullscreenComponent.current;
    if (element && element.requestFullscreen) {
      element.requestFullscreen();
    }
  };
  return (
    <div>
      <button onClick={openContentFullscreen}>Full Screen</button>
      <div className="modal" ref={myFullscreenComponent}>
        content I want to be fullscreen
      </div>
    </div>
  );
};
about 4 years ago · Santiago Trujillo Report

0

id recommend to use mui full-screen modal Here the link https://mui.com/material-ui/react-dialog/ let me know if you need any help

about 4 years ago · Santiago Trujillo Report

0

Check the following example

Note: set footer={null} if you want to hide OK and CANCEL buttons

App.js

import React, { useState } from 'react';
import 'antd/dist/antd.css';
import './index.css';
import { Button, Modal } from 'antd';

const App = () => {
  const [visible, setVisible] = useState(false);
  return (
    <>
      <Button type="primary" onClick={() => setVisible(true)}>
        Open Full screen Modal
      </Button>
      <Modal
        title="Full screen modal"
        visible={visible}
        //onOk={() => setVisible(false)}
        onCancel={() => setVisible(false)}
        footer={null} //If you want to hide OK and cancel buttons
      >
        <p>Full screen...</p>
        <p>Full screen...</p>
        <p>Full screen...</p>
        <p>Full screen...</p>
        <p>Full screen...</p>
      </Modal>
    </>
  );
};

export default App;

index.css

.ant-modal,
.ant-modal-content {
  height: 100vh;
  width: 100vw;
  top: 0;
  margin: 0;
}

Screenshot

screenshot

Demo

demo

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!