Page layout components for consistent page structure with header, actions, and content areas
The Layout components allow you to easily create pages with a consistent rendering in Nowts.
There are 6 components:
Layout: main container that defines the page layout
size?: "sm" | "default" | "lg" | "xl"default (max-width: 1024px) - 1024px widthsm (max-width: 768px) - compact widthlg (max-width: 1792px) - large widthxl (max-width: 1400px) - extra-large widthLayoutHeader: page header containing the title and description
LayoutTitle: page title (uses Typography h2 variant)
LayoutHeaderLayoutDescription: page description (uses default Typography)
LayoutHeaderLayoutActions: container for action buttons
LayoutContent: main content area of the page
import {
Layout,
LayoutActions,
LayoutContent,
LayoutDescription,
LayoutHeader,
LayoutTitle,
} from "@/features/page/layout";
export default function RoutePage(props: PageProps<"/route/path">) {
return (
<Layout size="lg">
<LayoutHeader>
<LayoutTitle>Page Title</LayoutTitle>
<LayoutDescription>Page description</LayoutDescription>
</LayoutHeader>
<LayoutActions className="gap-2">
<Button variant="outline">Delete</Button>
<Button>Create</Button>
</LayoutActions>
<LayoutContent className="flex flex-col gap-4">
<Typography variant="large">
Here is the page content with cards, text, etc.
</Typography>
<Card>
<CardHeader>
<CardTitle>Page Content</CardTitle>
<CardDescription>Additional content description.</CardDescription>
</CardHeader>
</Card>
</LayoutContent>
</Layout>
);
}
All components accept standard HTML element properties (className, style, etc.) via ComponentPropsWithoutRef.
type LayoutProps = ComponentPropsWithoutRef<"div"> & {
size?: "sm" | "default" | "lg" | "xl";
};
type Props = ComponentPropsWithoutRef<"div">;
type LayoutTitleProps = ComponentPropsWithoutRef<"h1">;
type LayoutDescriptionProps = ComponentPropsWithoutRef<"p">;