Make a Full screen Layout - Collapse and Close Using React Component
Making a Full-screen app using React is simple.
Let's make a Full-screen app using React with Little bit of the plugin of
Install Fullscreen Library
npm i react-full-screen
Add necessary Libraries to test our project
npm i @fortawesome/react-fontawesome @fortawesome/free-solid-svg-icons
App.js
import "./styles.css";
import { FullScreen, useFullScreenHandle } from "react-full-screen";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faArrowsAlt,
faExpandArrowsAlt
} from "@fortawesome/free-solid-svg-icons";
export default function App() {
const handle = useFullScreenHandle();
return (
<div className="App">
<button onClick={handle.enter}>
<FontAwesomeIcon icon={faExpandArrowsAlt} />
<i className="fa fa-expand"></i>
</button>
<FullScreen handle={handle}>
<div
style={{
background: "#233",
padding: 20,
marginTop: 20,
color: "#fff"
}}
>
{handle.active && (
<button onClick={handle.exit}>
<FontAwesomeIcon icon={faArrowsAlt} />
</button>
)}
<h1>Hello React Full Screen Example</h1>
<h2>
Just click on expand button to make full screen
<br />
</h2>
</div>
</FullScreen>
</div>
);
}
In styles.css
.App {
font-family: sans-serif;
text-align: center;
}
.fullscreen {
background: #fff !important;
}
Live Link to test full-screen:
Source Code in Code Sandbox: [Note]
Direct testing on Code sandbox will not work. Use the link to check on another page -
PHP If-else-elseif and Switch-case
PHP String Functions - All necessary String functions in PHP to manage strings better.
Popular Tutorials
Popular Tutorials
Categories
-
Artificial Intelligence (AI)
11
-
Bash Scripting
1
-
Bootstrap CSS
0
-
C Programming
14
-
C#
0
-
ChatGPT
1
-
Code Editor
2
-
Computer Engineering
3
-
CSS
28
-
Data Structure and Algorithm
18
-
Design Pattern in PHP
2
-
Design Patterns - Clean Code
1
-
E-Book
1
-
Git Commands
1
-
HTML
19
-
Interview Prepration
2
-
Java Programming
0
-
JavaScript
12
-
Laravel PHP Framework
37
-
Mysql
1
-
Node JS
1
-
Online Business
0
-
PHP
28
-
Programming
8
-
Python
12
-
React Js
19
-
React Native
1
-
Redux
2
-
Rust Programming
15
-
SEO - Search Engine Optimization
1
-
Tailwind CSS
1
-
Typescript
10
-
Uncategorized
0
-
Vue JS
1
-
Windows Operating system
1
-
Woocommerce
1
-
WordPress Development
2
Tags
- Artificial Intelligence (AI)
- Bash Scripting
- Business
- C
- C Programming
- C-sharp programming
- C++
- Code Editor
- Computer Engineering
- CSS
- Data Structure and Algorithm
- Database
- Design pattern
- Express JS
- git
- Git Commands
- github
- HTML
- Java
- JavaScript
- Laravel
- Mathematics
- MongoDB
- Mysql
- Node JS
- PHP
- Programming
- Python
- React Js
- Redux
- Rust Programming Language
- SEO
- TypeScript
- Vue JS
- Windows terminal
- Woocommerce
- WordPress
- WordPress Plugin Development