Usage
Container keeps page content at a readable width: it fills the available width up to its size and centers itself. It has no padding of its own, so the surrounding page stays in charge of spacing.
import { MtContainer } from "@shopware-ag/meteor-component-library";
Examples
Sizes
Three sizes are available: s (680px), m (960px, the default) and l (1280px). On narrower screens every size simply takes the full width.
Inside a page
Put the padding on the page and the container inside it. Use as to render a semantic element instead of a div.
API reference
Props
| Prop | Type | Default |
|---|---|---|
sizeThe maximum width of the container: `s` (680px), `m` (960px) or `l` (1280px).
The values come from the `--container-size-*` custom properties. | "s" | "m" | "l" | "m" |
asThe element or component that renders the container. | string | Component | "div" |
Slots
| Slot | Bindings |
|---|---|
default | any |
Best practices
Do
- Use
sfor forms and settings,mfor regular pages andlfor wide content such as tables or dashboards. - Keep padding and gaps on the page or a wrapper around the container.
- Use one container per page and nest the page content inside it.
Don't
- Do not add padding or borders to the container itself; wrap the content instead.
- Do not nest containers to fine-tune widths.
Behavior
The widths come from three custom properties defined in the library's global stylesheet. Override them on :root to change the sizes for the whole application.
| Size | Custom property | Default |
|---|---|---|
s | --container-size-s | 680px |
m | --container-size-m | 960px |
l | --container-size-l | 1280px |