install & setup vite + react + typescript + mui 5

Install & Setup Vite + React + Typescript + MUI 5

updated 11/05/23 By frontendshape

Today, we will install & setup vite + react + typescript + material ui (MUI 5). We will use react 18 and vite and mui 5.

Install React Project With Vite

Install vite via npm:

npm create [email protected]

Install vite via yarn:

yarn create vite

Select react.

? Select a framework: › - Use arrow-keys. Return to submit.
❯  react

Select react js with typescript.

Select a framework: › react
? Select a variant: › - Use arrow-keys. Return to submit.
❯  react-ts

Move to project directory and install dependencies.

cd react-mui
npm install 
npm run dev 

Install React Material UI 5 (MUI)

install mui 5 via npm:

npm install @mui/material @emotion/react @emotion/styled

Or install mui 5 via yarn:

yarn add @mui/material @emotion/react @emotion/styled

import mui button component in App.tsx.


import { useState } from 'react';
import reactLogo from './assets/react.svg';
import './App.css';
import { Button } from '@mui/material';

function App() {
  const [count, setCount] = useState(0);

  return (
    <div className="App">
        <a href="" target="_blank">
          <img src="/vite.svg" className="logo" alt="Vite logo" />
        <a href="" target="_blank">
          <img src={reactLogo} className="logo react" alt="React logo" />
      <h1>Vite + React + + Typescript + MUI 5</h1>
      <Button color="secondary">Secondary</Button>
      <Button variant="contained" color="success">
      <Button variant="outlined" color="error">
      <div className="card">
        <button onClick={() => setCount((count) => count + 1)}>
          count is {count}
          Edit <code>src/App.tsx</code> and save to test HMR
      <p className="read-the-docs">
        Click on the Vite and React logos to learn more

export default App;
install vite + react 18 + typescript + mui 5

install vite + react 18 + typescript + mui 5