You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/data/joy/components/box/box.md
+49-5Lines changed: 49 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,57 @@ components: Box
5
5
githubLabel: 'component: Box'
6
6
---
7
7
8
+
<!-- This page's content is duplicated (with some product-specific details) across the Material UI, Joy UI, and MUI System docs. Any changes should be applied to all three pages at the same time. -->
9
+
8
10
# Box
9
11
10
12
<pclass="description">The Box component is a generic, theme-aware container with access to CSS utilities from MUI System.</p>
11
13
12
-
:::warning
13
-
Please refer to the [Box](/system/react-box/) component page in the MUI System docs for demos and details on usage.
The Box component is a generic container for grouping other components.
19
+
It's a fundamental building block when working with Joy UI—you can think of it as a `<div>` with extra built-in features, like access to your app's theme and the [`sx` prop](/system/getting-started/the-sx-prop/).
20
+
21
+
### Usage
22
+
23
+
The Box component differs from other containers available in Joy UI in that its usage is intended to be multipurpose and open-ended, just like a `<div>`.
24
+
Components like [Stack](/joy-ui/react-stack/) and [Sheet](/joy-ui/react-sheet/), by contrast, feature usage-specific props that make them ideal for certain use cases: Stack for one-dimensional layouts, and Sheet for surfaces that need access to Joy UI's global variants.
25
+
26
+
## Basics
27
+
28
+
```jsx
29
+
importBoxfrom'@mui/joy/Box';
30
+
```
31
+
32
+
The Box component renders as a `<div>` by default, but you can swap in any other valid HTML tag or React component using the `component` prop.
33
+
The demo below replaces the `<div>` with a `<section>` element:
Use the [`sx` prop](/system/getting-started/the-sx-prop/) to quickly customize any Box instance using a superset of CSS that has access to all the style functions and theme-aware properties exposed in the MUI System package.
49
+
The demo below shows how to apply colors from the theme using this prop:
50
+
51
+
{{"demo": "BoxSx.js", "defaultCodeOpen": true }}
52
+
53
+
## Anatomy
54
+
55
+
The Box component is composed of a single root `<div>` element:
14
56
15
-
The Box component is a part of the standalone [MUI System](/system/getting-started/) utility library.
16
-
It is re-exported from `@mui/joy` for your convenience.
0 commit comments