--- title: Box description: "`Box` is the most abstract component on which all other components are built. By default, it renders a `div` element." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/box - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-box--basic --- # Box `Box` is the most abstract component on which all other components are built. By default, it renders a `div` element. ```tsx This is the Box ``` ## Usage ```tsx import { Box } from "@yamada-ui/react" ``` ```tsx import { Box } from "@/components/ui" ``` ```tsx import { Box } from "@workspaces/ui" ``` ```tsx ``` :::tip `Box` is a general-purpose container. It has no specific semantics or layout, so use it when styling is needed that cannot be achieved with other components. ::: :::tip Yamada UI provides many semantic components. First consider whether those components can meet your needs, and use `Box` only as a last resort when they cannot. ::: :::tip Because `Box` is a general-purpose container, it can make the intent of your code harder to understand. We recommend using semantic components whenever possible. ::: ### Render a different element By passing `as`, you can render it as a different element. ```tsx This is the section ``` ## Props | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ## Similar Components - [Bleed](https://yamada-ui.com/docs/components/bleed.md): `Bleed` is a component used to extend elements beyond the boundaries of a container. - [Center](https://yamada-ui.com/docs/components/center.md): `Center` is a component that aligns the child elements in the center within the component. - [Container](https://yamada-ui.com/docs/components/container.md): `Container` is a component used as a general division element. By default, it renders the `section` element. - [Flex](https://yamada-ui.com/docs/components/flex.md): `Flex` is a component that sets `flex` to `Box`. Also, convenient style shorthand is available. - [Float](https://yamada-ui.com/docs/components/float.md): `Float` is a component used to fix elements to the edges of a container. - [Grid](https://yamada-ui.com/docs/components/grid.md): `Grid` is a component for managing grid layouts. It also comes with handy style shorthand. - [Group](https://yamada-ui.com/docs/components/group.md): `Group` is a component that groups and attaches multiple elements together. - [HStack](https://yamada-ui.com/docs/components/h-stack.md): `HStack` is used to stack child elements horizontally.