Material UI is an open-source React component library that implements Google's Material Design
npx @tessl/cli install tessl/npm-mui--material@7.3.00
# Material UI
1
2
Material UI is an open-source React component library that implements Google's Material Design. It provides 139 production-ready components including buttons, forms, navigation, layout, data display, and feedback elements with a robust theming system, responsive breakpoints, dark mode support, and advanced styling solutions.
3
4
## Package Information
5
6
- **Package Name**: @mui/material
7
- **Package Type**: npm
8
- **Language**: TypeScript/JavaScript (React)
9
- **Installation**: `npm install @mui/material @emotion/react @emotion/styled`
10
11
## Core Imports
12
13
```typescript
14
import { Button, TextField, AppBar, Toolbar } from "@mui/material";
15
import { ThemeProvider, createTheme } from "@mui/material/styles";
16
```
17
18
For CommonJS:
19
20
```javascript
21
const { Button, TextField, AppBar, Toolbar } = require("@mui/material");
22
const { ThemeProvider, createTheme } = require("@mui/material/styles");
23
```
24
25
## Basic Usage
26
27
```typescript
28
import React from "react";
29
import { Button, TextField, Container, Typography } from "@mui/material";
30
import { ThemeProvider, createTheme } from "@mui/material/styles";
31
32
const theme = createTheme({
33
palette: {
34
primary: {
35
main: "#1976d2",
36
},
37
},
38
});
39
40
function App() {
41
return (
42
<ThemeProvider theme={theme}>
43
<Container maxWidth="sm">
44
<Typography variant="h4" component="h1" gutterBottom>
45
Welcome to Material UI
46
</Typography>
47
<TextField
48
label="Your Name"
49
variant="outlined"
50
fullWidth
51
margin="normal"
52
/>
53
<Button
54
variant="contained"
55
color="primary"
56
size="large"
57
fullWidth
58
sx={{ mt: 2 }}
59
>
60
Get Started
61
</Button>
62
</Container>
63
</ThemeProvider>
64
);
65
}
66
```
67
68
## Architecture
69
70
Material UI is built around several key architectural patterns:
71
72
- **Component System**: 88 production-ready React components implementing Material Design specifications
73
- **Theming System**: Comprehensive theme customization with design tokens, breakpoints, and color schemes
74
- **Styling Engine**: CSS-in-JS with emotion, sx prop system, and styled-components API
75
- **Layout System**: Responsive grid, stack, and container components with breakpoint system
76
- **Type Safety**: Full TypeScript support with extensive type definitions and interfaces
77
- **Accessibility**: WCAG-compliant components with built-in ARIA support and keyboard navigation
78
79
## Capabilities
80
81
### Layout Components
82
83
Responsive layout and container components for structuring applications with Material Design spacing and breakpoints.
84
85
```typescript { .api }
86
// Container for centering and constraining content
87
function Container(props: ContainerProps): JSX.Element;
88
89
// Flexible grid layout using CSS Flexbox
90
function Grid(props: GridProps): JSX.Element;
91
92
// One-dimensional layout for vertical/horizontal stacking
93
function Stack(props: StackProps): JSX.Element;
94
95
// Basic layout component with system props
96
function Box(props: BoxProps): JSX.Element;
97
```
98
99
[Layout Components](./layout.md)
100
101
### Form Components
102
103
Complete form controls including text fields, selects, checkboxes, and form validation with Material Design styling.
104
105
```typescript { .api }
106
// Complete text field with label, input and helper text
107
function TextField(props: TextFieldProps): JSX.Element;
108
109
// Form control wrapper providing context
110
function FormControl(props: FormControlProps): JSX.Element;
111
112
// Select dropdown component
113
function Select(props: SelectProps): JSX.Element;
114
115
// Checkbox input component
116
function Checkbox(props: CheckboxProps): JSX.Element;
117
```
118
119
[Form Components](./forms.md)
120
121
### Navigation Components
122
123
Navigation elements including app bars, drawers, menus, tabs, breadcrumbs, steppers, and pagination for application structure.
124
125
```typescript { .api }
126
// Application bar for navigation and branding
127
function AppBar(props: AppBarProps): JSX.Element;
128
129
// Navigation drawer panel
130
function Drawer(props: DrawerProps): JSX.Element;
131
132
// Navigation links with Material-UI styling
133
function Link(props: LinkProps): JSX.Element;
134
135
// Tab navigation component
136
function Tabs(props: TabsProps): JSX.Element;
137
138
// Menu component for displaying choices
139
function Menu(props: MenuProps): JSX.Element;
140
141
// Component for displaying list of menu items
142
function MenuList(props: MenuListProps): JSX.Element;
143
144
// Navigation for mobile interfaces with bottom actions
145
function BottomNavigation(props: BottomNavigationProps): JSX.Element;
146
147
// Individual action for BottomNavigation
148
function BottomNavigationAction(props: BottomNavigationActionProps): JSX.Element;
149
150
// Container for step navigation
151
function Stepper(props: StepperProps): JSX.Element;
152
153
// Compact stepper for mobile interfaces
154
function MobileStepper(props: MobileStepperProps): JSX.Element;
155
156
// Pagination component for page navigation
157
function Pagination(props: PaginationProps): JSX.Element;
158
```
159
160
[Navigation Components](./navigation.md)
161
162
### Input Controls
163
164
Interactive input components including buttons, sliders, switches, rating, toggle buttons, and advanced controls like autocomplete.
165
166
```typescript { .api }
167
// Button with multiple variants and states
168
function Button(props: ButtonProps): JSX.Element;
169
170
// Icon button for displaying clickable icons
171
function IconButton(props: IconButtonProps): JSX.Element;
172
173
// Floating action button for primary actions
174
function Fab(props: FabProps): JSX.Element;
175
176
// Component for grouping related buttons
177
function ButtonGroup(props: ButtonGroupProps): JSX.Element;
178
179
// Foundation component for building custom buttons
180
function ButtonBase(props: ButtonBaseProps): JSX.Element;
181
182
// Slider for selecting values from range
183
function Slider(props: SliderProps): JSX.Element;
184
185
// Switch toggle control
186
function Switch(props: SwitchProps): JSX.Element;
187
188
// Star rating input for collecting user ratings
189
function Rating(props: RatingProps): JSX.Element;
190
191
// Toggle button for binary selection
192
function ToggleButton(props: ToggleButtonProps): JSX.Element;
193
194
// Autocomplete input with suggestions
195
function Autocomplete<T>(props: AutocompleteProps<T>): JSX.Element;
196
```
197
198
[Input Controls](./inputs.md)
199
200
### Data Display
201
202
Components for displaying data including lists, tables, cards, chips, image lists, and typography with consistent styling.
203
204
```typescript { .api }
205
// Compact elements that represent input, attribute, or action
206
function Chip(props: ChipProps): JSX.Element;
207
208
// Typography component for text display
209
function Typography(props: TypographyProps): JSX.Element;
210
211
// Visual content separator for organizing sections
212
function Divider(props: DividerProps): JSX.Element;
213
214
// Component for displaying font icons
215
function Icon(props: IconProps): JSX.Element;
216
217
// Wrapper for displaying SVG icons with Material-UI styling
218
function SvgIcon(props: SvgIconProps): JSX.Element;
219
220
// Component for displaying multiple avatars in a group
221
function AvatarGroup(props: AvatarGroupProps): JSX.Element;
222
223
// List component for displaying content in rows
224
function List(props: ListProps): JSX.Element;
225
226
// Table component for tabular data
227
function Table(props: TableProps): JSX.Element;
228
229
// Card component for containing related information
230
function Card(props: CardProps): JSX.Element;
231
232
// Image list for displaying collections of images
233
function ImageList(props: ImageListProps): JSX.Element;
234
```
235
236
[Data Display](./data-display.md)
237
238
### Feedback Components
239
240
User feedback components including alerts, progress indicators, dialogs, and snackbars.
241
242
```typescript { .api }
243
// Alert component for important messages
244
function Alert(props: AlertProps): JSX.Element;
245
246
// Title component for Alert messages
247
function AlertTitle(props: AlertTitleProps): JSX.Element;
248
249
// Base modal component for overlaying content
250
function Modal(props: ModalProps): JSX.Element;
251
252
// Backdrop component for displaying overlay behind modal content
253
function Backdrop(props: BackdropProps): JSX.Element;
254
255
// Circular progress indicator
256
function CircularProgress(props: CircularProgressProps): JSX.Element;
257
258
// Dialog component for modal content
259
function Dialog(props: DialogProps): JSX.Element;
260
261
// Brief message component at bottom of screen
262
function Snackbar(props: SnackbarProps): JSX.Element;
263
```
264
265
[Feedback Components](./feedback.md)
266
267
### Surface Components
268
269
Surface components including paper, cards, and accordions providing elevation and content organization.
270
271
```typescript { .api }
272
// Basic surface component with Material Design elevation
273
function Paper(props: PaperProps): JSX.Element;
274
275
// Expandable panels for organizing content
276
function Accordion(props: AccordionProps): JSX.Element;
277
278
// Badge for displaying small amounts of data
279
function Badge(props: BadgeProps): JSX.Element;
280
281
// Tooltip for additional information
282
function Tooltip(props: TooltipProps): JSX.Element;
283
```
284
285
[Surface Components](./surfaces.md)
286
287
### Styling System
288
289
Comprehensive theming and styling system with theme creation, color manipulation, and CSS utilities.
290
291
```typescript { .api }
292
// Creates custom themes
293
function createTheme(options?: ThemeOptions): Theme;
294
295
// Context provider for themes
296
function ThemeProvider(props: { theme: Theme; children: ReactNode }): JSX.Element;
297
298
// Hook for accessing current theme
299
function useTheme(): Theme;
300
301
// Styled-components API for creating styled components
302
function styled<C extends React.ComponentType<any>>(
303
component: C
304
): StyledComponent<C>;
305
```
306
307
[Styling System](./styling.md)
308
309
### Utility Components
310
311
Utility components for common functionality including click-away listeners, portals, and transitions.
312
313
```typescript { .api }
314
// Utility component for detecting clicks outside element
315
function ClickAwayListener(props: ClickAwayListenerProps): JSX.Element;
316
317
// Component for rendering children outside normal hierarchy
318
function Portal(props: PortalProps): JSX.Element;
319
320
// Fade transition component
321
function Fade(props: FadeProps): JSX.Element;
322
323
// Hook for responsive design with media queries
324
function useMediaQuery(query: string | ((theme: Theme) => string)): boolean;
325
```
326
327
[Utility Components](./utilities.md)
328
329
## Color System
330
331
Material Design color palettes and color manipulation utilities.
332
333
```typescript { .api }
334
// Material Design color palettes
335
const colors: {
336
red: ColorPalette;
337
blue: ColorPalette;
338
green: ColorPalette;
339
// ... 17 more color palettes
340
};
341
342
// Color manipulation functions
343
function alpha(color: string, value: number): string;
344
function darken(color: string, coefficient: number): string;
345
function lighten(color: string, coefficient: number): string;
346
```
347
348
[Color System](./colors.md)
349
350
## Common Types
351
352
```typescript { .api }
353
// Base props for all Material UI components
354
interface CommonProps {
355
className?: string;
356
style?: React.CSSProperties;
357
sx?: SxProps<Theme>;
358
}
359
360
// Theme interface
361
interface Theme {
362
palette: Palette;
363
typography: Typography;
364
spacing: Spacing;
365
breakpoints: Breakpoints;
366
zIndex: ZIndex;
367
transitions: Transitions;
368
shadows: Shadows;
369
shape: Shape;
370
}
371
372
// Color palette interface
373
interface Palette {
374
mode: 'light' | 'dark';
375
primary: PaletteColor;
376
secondary: PaletteColor;
377
error: PaletteColor;
378
warning: PaletteColor;
379
info: PaletteColor;
380
success: PaletteColor;
381
grey: GreyPalette;
382
common: CommonColors;
383
text: TypeText;
384
background: TypeBackground;
385
action: TypeAction;
386
}
387
388
// SX prop type for inline styling
389
type SxProps<Theme = {}> =
390
| SystemStyleObject<Theme>
391
| ((theme: Theme) => SystemStyleObject<Theme>)
392
| Array<SystemStyleObject<Theme> | ((theme: Theme) => SystemStyleObject<Theme>)>;
393
```