# Installation

Default installation

Run one of the following commands to add Material UI to your project:

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

#### Peer dependencies <a href="#peer-dependencies" id="peer-dependencies"></a>

Please note that [react](https://www.npmjs.com/package/react) and [react-dom](https://www.npmjs.com/package/react-dom) are peer dependencies, meaning you should ensure they are installed before installing Material UI.

```json
"peerDependencies": {
  "react": "^17.0.0 || ^18.0.0",
  "react-dom": "^17.0.0 || ^18.0.0"
},
```

### With styled-components <a href="#with-styled-components" id="with-styled-components"></a>

Material UI uses [Emotion](https://emotion.sh/docs/introduction) as its default styling engine. If you want to use [styled-components](https://styled-components.com/) instead, run one of the following commands:

npmyarnpnpm

```bash
npm install @mui/material @mui/styled-engine-sc styled-components
```

Next, follow the [styled-components how-to guide](https://mui.com/material-ui/integrations/styled-components/) to properly configure your bundler to support `@mui/styled-engine-sc`.

As of late 2021, [styled-components](https://github.com/styled-components/styled-components) is **not compatible** with server-rendered Material UI projects. This is because `babel-plugin-styled-components` isn't able to work with the `styled()` utility inside `@mui` packages. See [this GitHub issue](https://github.com/mui/material-ui/issues/29742) for more details.

We **strongly recommend** using Emotion for SSR projects.

### Roboto font <a href="#roboto-font" id="roboto-font"></a>

Material UI uses the [Roboto](https://fonts.google.com/specimen/Roboto) font by default. Add it to your project via Fontsource, or with the Google Fonts CDN.

npmyarnpnpm

```bash
npm install @fontsource/roboto
```

Then you can import it in your entry point like this:

```tsx
import '@fontsource/roboto/300.css';
import '@fontsource/roboto/400.css';
import '@fontsource/roboto/500.css';
import '@fontsource/roboto/700.css';
```

Fontsource can be configured to load specific subsets, weights and styles. Material UI's default typography configuration relies only on the 300, 400, 500, and 700 font weights.

#### Google Web Fonts <a href="#google-web-fonts" id="google-web-fonts"></a>

To install Roboto through the Google Web Fonts CDN, add the following code inside your project's `<head />` tag:

```html
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
  rel="stylesheet"
  href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"
/>
```

### Icons <a href="#icons" id="icons"></a>

To use the [font Icon component](https://mui.com/material-ui/icons/#icon-font-icons) or the prebuilt SVG Material Icons (such as those found in the [icon demos](https://mui.com/material-ui/icons/)), you must first install the [Material Icons](https://fonts.google.com/icons?icon.set=Material+Icons) font. You can do so with npm, or with the Google Web Fonts CDN.

npmyarnpnpm

```bash
npm install @mui/icons-material
```

#### Google Web Fonts <a href="#google-web-fonts-2" id="google-web-fonts-2"></a>

To install the Material Icons font in your project using the Google Web Fonts CDN, add the following code snippet inside your project's `<head />` tag:

To use the font `Icon` component, you must first add the [Material Icons](https://fonts.google.com/icons?icon.set=Material+Icons) font. Here are [some instructions](https://mui.com/material-ui/icons/#icon-font-icons) on how to do so. For instance, via Google Web Fonts:

```html
<link
  rel="stylesheet"
  href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>
```

### CDN <a href="#cdn" id="cdn"></a>

You can start using Material UI right away with minimal front-end infrastructure by installing it via CDN, which is a great option for rapid prototyping. Follow [this CDN example](https://github.com/mui/material-ui/tree/master/examples/material-ui-via-cdn) to get started.

We do *not* recommend using this approach in production. It requires the client to download the entire library—regardless of which components are actually used—which negatively impacts performance and bandwidth utilization.

Two Universal Module Definition (UMD) files are provided:

* one for development: <https://unpkg.com/@mui/material@latest/umd/material-ui.development.js>
* one for production: <https://unpkg.com/@mui/material@latest/umd/material-ui.production.min.js>

The UMD links use the `latest` tag to point to the latest version of the library. This pointer is *unstable* and subject to change as we release new versions. You should consider pointing to a specific version, such as [v5.0.0](https://unpkg.com/@mui/material@5.0.0/umd/material-ui.development.js).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://8bit-1.gitbook.io/solana-wallet-connect-tutorial/react-and-next.js/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
