Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

180
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda