Container
Centers page content and caps its width, so sections share one line length and side margins.
<arc-container>Overview
Container constrains width. It centers its content with margin-inline: auto, caps it at the --max-width token (1120px by default) and adds --space-lg of inline padding. Use it around page sections so line lengths and side margins match across the page.
size picks the cap: sm is --max-width-sm (720px), md is the default, lg is 1400px, xl is 1600px and full removes it. Use sm for articles and single-column forms. narrow is the same cap as size="sm". It applies while size is left at md, so narrow size="lg" is 1400px. padding sets the inline padding to none, sm, md (the default) or lg.
It sets only inline spacing, with logical properties, so it works in right-to-left layouts. Vertical spacing is up to the parent or a Section.
Guidelines
Do
- Put a Container inside a Section when you need both vertical spacing and a width cap
- Change the `--max-width` and `--max-width-sm` tokens to change widths across the site
- Use DashboardGrid or another grid inside it for the inner layout
Don't
- Don't nest Containers. The inline padding doubles
- Don't override `padding-inline` with fixed pixels. Use the `padding` prop or the `--space-*` tokens
- Don't make it a flex or grid parent. Its children are inside the inner wrapper, so `display` on the host doesn't lay them out
- Don't use it for column structure. That's PageLayout
Features
- Content renders inside an inner wrapper exposed as the `container` CSS part, for one-off `::part(container)` changes
Preview
Usage
<arc-container>
<p>Content constrained to 1120px</p>
</arc-container>
<arc-container narrow>
<p>Content constrained to 720px</p>
</arc-container>import { Container } from '@arclux/arc-ui-react';
export default function Example() {
return (
<Container>
<p>Content constrained to 1120px</p>
</Container>
);
}<script setup>
import { Container } from '@arclux/arc-ui-vue';
</script>
<template>
<Container>
<p>Content constrained to 1120px</p>
</Container>
<Container narrow>
<p>Content constrained to 720px</p>
</Container>
</template><script>
import { Container } from '@arclux/arc-ui-svelte';
</script>
<Container>
<p>Content constrained to 1120px</p>
</Container>
<Container narrow>
<p>Content constrained to 720px</p>
</Container>import { Component } from '@angular/core';
import { Container } from '@arclux/arc-ui-angular';
@Component({
imports: [Container],
template: `
<arc-container>
<p>Content constrained to 1120px</p>
</arc-container>
<arc-container narrow>
<p>Content constrained to 720px</p>
</arc-container>
`,
})
export class MyComponent {}import { Container } from '@arclux/arc-ui-solid';
export default function Example() {
return (
<>
<Container>
<p>Content constrained to 1120px</p>
</Container>
<Container narrow>
<p>Content constrained to 720px</p>
</Container>
</>
);
}import { Container } from '@arclux/arc-ui-preact';
export default function Example() {
return (
<>
<Container>
<p>Content constrained to 1120px</p>
</Container>
<Container narrow>
<p>Content constrained to 720px</p>
</Container>
</>
);
}<!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-container — requires container.css + base.css (or arc-ui.css) -->
<div class="arc-container">
<div class="container">Container</div>
</div><!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-container — self-contained, no external CSS needed -->
<div class="arc-container" style="display: block">
<div style="width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 24px">Container</div>
</div>API
narrowbooleanfalse- Caps the width at
--max-width-sm(720px by default), the same assize="sm". Applies whilesizeis the defaultmd; asizeoflg,xlorfullwins over it. size'sm' | 'md' | 'lg' | 'xl' | 'full''md'- Controls the maximum width.
padding'none' | 'sm' | 'md' | 'lg''md'- Controls inline padding.
See also
- SectionA page section with vertical padding, a centered max width and an optional uppercase label.
- StackLays out its children in a column or a row, spaced by a gap from the spacing scale.
- Page LayoutA CSS Grid page frame whose `layout` attribute picks a left sidebar, a right aside, a centered column or full width.