Layout
Recetas de layout
Contenedor de página, columnas adaptables, contenido centrado, formularios, paneles, barras de navegación, navegación vertical y layouts de contenido con barra lateral.
Cada receta es un módulo en vivo y copiable, construido solo con los paquetes públicos.
Contenedor de página
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>
);
}Columnas adaptables
Vista previa: grid-columns
Revenue
Customers
Orders
Refunds
Visits
Conversion
import { Grid } from "@neshel-ui/layout";
import { Tile } from "./_tile";
const cards = ["Revenue", "Customers", "Orders", "Refunds", "Visits", "Conversion"];
/** One column on phones, two from sm, three from lg (responsive columns recipe). */
export default function GridColumns() {
return (
<Grid columns={{ base: 1, sm: 2, lg: 3 }} space={{ base: "2", md: "4" }}>
{cards.map((card) => (
<Tile key={card}>{card}</Tile>
))}
</Grid>
);
}Contenido centrado
Vista previa: center-basic
No projects yet
Create your first project to get started.
import { Button } from "@neshel-ui/components";
import { Center, Stack } from "@neshel-ui/layout";
import { Heading, Paragraph } from "@neshel-ui/typography";
/** Centered content: an empty state centred on both axes inside a fixed-height region. */
export default function CenterBasic() {
return (
<Center className="min-h-56 rounded-lg border border-dashed border-[var(--neshel-border)]">
<Stack space="3" alignX="center">
<Heading as="h3" size="lg">
No projects yet
</Heading>
<Paragraph tone="muted" size="sm">
Create your first project to get started.
</Paragraph>
<Button size="sm">New project</Button>
</Stack>
</Center>
);
}Layout de formulario
Vista previa: recipe-form
import { Button, Input, Label } from "@neshel-ui/components";
import { Grid, Inline, Stack } from "@neshel-ui/layout";
import { Heading } from "@neshel-ui/typography";
/** Form layout: label/field pairs in a Stack, two columns from md, actions at the end. */
export default function RecipeForm() {
return (
<Stack as="form" space="6" aria-labelledby="recipe-form-title" className="max-w-xl">
<Heading as="h3" size="lg" id="recipe-form-title">
Billing details
</Heading>
<Grid columns={{ base: 1, md: 2 }} spaceX="4" spaceY="5">
<Stack space="2">
<Label htmlFor="recipe-first">First name</Label>
<Input id="recipe-first" name="firstName" autoComplete="given-name" />
</Stack>
<Stack space="2">
<Label htmlFor="recipe-last">Last name</Label>
<Input id="recipe-last" name="lastName" autoComplete="family-name" />
</Stack>
</Grid>
<Stack space="2">
<Label htmlFor="recipe-email">Email</Label>
<Input id="recipe-email" name="email" type="email" autoComplete="email" />
</Stack>
<Inline space="3" justify="end">
<Button type="reset" variant="ghost">
Reset
</Button>
<Button type="submit">Save</Button>
</Inline>
</Stack>
);
}Rejilla de panel
Vista previa: recipe-dashboard
Revenue
$48,200
Active users
1,284
Open tickets
17
Uptime
99.95%
Activity
Chart placeholder
Team
Members list
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@neshel-ui/components";
import { Grid, Stack } from "@neshel-ui/layout";
import { Heading, Text } from "@neshel-ui/typography";
const stats = [
{ label: "Revenue", value: "$48,200" },
{ label: "Active users", value: "1,284" },
{ label: "Open tickets", value: "17" },
{ label: "Uptime", value: "99.95%" },
];
/** Dashboard grid: KPI cards (1 → 2 → 4 columns) above a two-column content area. */
export default function RecipeDashboard() {
return (
<Stack space="6">
<Grid columns={{ base: 1, sm: 2, xl: 4 }} space="4">
{stats.map((stat) => (
<Card key={stat.label} padding="sm">
<CardHeader>
<CardDescription>{stat.label}</CardDescription>
<CardTitle as="p">
<Text size="2xl" weight="bold">
{stat.value}
</Text>
</CardTitle>
</CardHeader>
</Card>
))}
</Grid>
<Grid columns={{ base: 1, lg: 3 }} space="4">
<Card className="lg:col-span-2">
<CardHeader>
<CardTitle>Activity</CardTitle>
</CardHeader>
<CardContent>
<Text tone="muted">Chart placeholder</Text>
</CardContent>
</Card>
<Card>
<CardHeader>
<Heading as="h3" size="base">
Team
</Heading>
</CardHeader>
<CardContent>
<Text tone="muted">Members list</Text>
</CardContent>
</Card>
</Grid>
</Stack>
);
}Layout de barra de navegación
Una cabecera estática construida con Inline. Para una navegación adaptable con menú móvil, usa
Navbar.
Vista previa: recipe-navbar
import { Button } from "@neshel-ui/components";
import { Inline } from "@neshel-ui/layout";
import { Text } from "@neshel-ui/typography";
/**
* Navbar layout from primitives: brand, links and actions spread with justify="between".
* For a full responsive navbar with a mobile menu, use the Navbar component.
*/
export default function RecipeNavbar() {
return (
<Inline
as="header"
space="4"
justify="between"
align="center"
className="rounded-lg border border-[var(--neshel-border)] px-4 py-3"
>
<Text weight="bold">Acme</Text>
<Inline as="nav" aria-label="Main" space="4">
<a href="#features">Features</a>
<a href="#pricing">Pricing</a>
</Inline>
<Button size="sm">Sign up</Button>
</Inline>
);
}Navegación vertical
Una lista de enlaces para páginas de ajustes. Para una barra lateral de aplicación que se contrae y se convierte en cajón en móvil, usa Sidebar.
Vista previa: recipe-vertical-nav
import { Stack } from "@neshel-ui/layout";
import { Caption, Text } from "@neshel-ui/typography";
const sections = [
{ title: "Account", links: ["Profile", "Security"] },
{ title: "Workspace", links: ["Members", "Billing", "Integrations"] },
];
/** Vertical navigation built from layout primitives only (no Sidebar behaviour needed). */
export default function RecipeVerticalNav() {
return (
<Stack as="nav" aria-label="Settings" space="5" className="max-w-56">
{sections.map((section) => (
<Stack key={section.title} space="2">
<Caption as="span">{section.title}</Caption>
<Stack as="ul" space="1">
{section.links.map((link, index) => (
<li key={link}>
<Text asChild size="sm" weight={index === 0 ? "semibold" : "regular"}>
<a
href={`#${link.toLowerCase()}`}
aria-current={index === 0 ? "page" : undefined}
>
{link}
</a>
</Text>
</li>
))}
</Stack>
</Stack>
))}
</Stack>
);
}Contenido y barra lateral
Vista previa: recipe-content-sidebar
Release notes
The article column grows and shrinks; long text keeps a comfortable measure so lines stay readable on wide screens.
import { Flex, Stack } from "@neshel-ui/layout";
import { Heading, Paragraph, Text } from "@neshel-ui/typography";
/**
* Content/sidebar layout: stacked on small screens, side by side from lg. The sidebar keeps a
* fixed inline size; the article takes the remaining space (flex-1 utility from Tailwind).
*/
export default function RecipeContentSidebar() {
return (
<Flex direction={{ base: "column", lg: "row" }} space="8" alignY="start">
<Stack as="article" space="4" className="min-w-0 flex-1">
<Heading as="h3" size="xl">
Release notes
</Heading>
<Paragraph measure="comfortable">
The article column grows and shrinks; long text keeps a comfortable measure so lines stay
readable on wide screens.
</Paragraph>
</Stack>
<Stack as="aside" aria-label="On this page" space="2" className="lg:w-56">
<Text weight="semibold" size="sm">
On this page
</Text>
<Stack as="ul" space="1">
<li>
<a href="#highlights">Highlights</a>
</li>
<li>
<a href="#breaking">Breaking changes</a>
</li>
</Stack>
</Stack>
</Flex>
);
}