Layout
Container
Un contenedor de página centrado, con ancho máximo y margen interior lateral adaptable.
Propósito
Container limita el contenido a un ancho máximo legible, lo centra con márgenes laterales
automáticos y añade un margen interior lateral (padding) que puedes variar por breakpoint.
Importación
import { Container } from "@neshel-ui/layout";Uso
Vista previa: container-sizes
Container size “sm”
Container size “md”
Container size “lg”
import { Container, Stack } from "@neshel-ui/layout";
import { Tile } from "./_tile";
const sizes = ["sm", "md", "lg"] as const;
/** Page container: a centred max-width with a responsive inline gutter. */
export default function ContainerSizes() {
return (
<Stack space="3">
{sizes.map((size) => (
<Container key={size} size={size} gutter={{ base: "2", md: "4" }}>
<Tile>Container size “{size}”</Tile>
</Container>
))}
</Stack>
);
}API
ContainerProps
| Prop | Tipo | Predeterminado | Descripción |
|---|---|---|---|
| as | LayoutElement | — | — |
| asChild | boolean | — | — |
| gutter | Responsive<SpaceValue> | — | — |
| ref | Ref<HTMLElement> | — | — |
| size | Responsive<ContainerSize> | — | — |
También acepta las props de: React DOM attributes.
ContainerSize
type ContainerSize = "sm" | "md" | "lg" | "xl" | "2xl" | "full"size(adaptable) fijamax-width;fullelimina el límite.gutter(adaptable) usa los tokens de espaciado para el margen interior lateral.
Errores habituales
- Importar la hoja de layout antes de Tailwind: el preflight elimina entonces los márgenes automáticos. Importa Tailwind primero.
- Anidar Containers: basta con uno por columna de página.