Layout Patterns
Reusable layout components in Plainform for consistent page structure and spacing
Layout patterns provide consistent structure, spacing, and styling across your application. These components handle common layout needs like sections, headers, and gradient backgrounds.
Section Component
The Section component creates consistent page sections with automatic spacing and responsive padding.
Props
| Section Props | Type | Default |
|---|---|---|
children | React.ReactNode | - |
className? | string | - |
offsetTop? | boolean | false |
id? | string | - |
Usage
import { Section } from '@/components/Section';
export default function HomePage() {
return (
<main>
<Section id="hero" offsetTop>
<h1>Welcome</h1>
<p>Your content here</p>
</Section>
<Section id="features">
<h2>Features</h2>
{/* Feature content */}
</Section>
</main>
);
}Features
- Consistent Spacing: Automatic padding and gap between elements
- Responsive: Adapts padding for mobile (
px-20 max-md:px-7) - Max Width: Constrains content to
max-w-8xlfor readability - Centered Content: Flexbox centering for vertical and horizontal alignment
- Offset Support:
offsetTopaddsh-[calc(100svh-4.5rem)] mt-[4.5rem]for full-height hero sections
SectionHeader Component
The SectionHeader component creates consistent section titles with optional descriptions.
Props
| SectionHeader Props | Type | Default |
|---|---|---|
title | string | - |
children? | React.ReactNode | - |
isLongHeading? | boolean | false |
className? | string | - |
Usage
import { Section } from '@/components/Section';
import { SectionHeader } from '@/components/SectionHeader';
export function Features() {
return (
<Section>
<SectionHeader
title={'Powerful Features\nBuilt for developers'}
>
{'Everything you need to build modern web applications'}
</SectionHeader>
{/* Feature cards */}
</Section>
);
}Features
- Multi-Line Titles: Use
\nin the title string for line breaks - Long Heading Support:
isLongHeadingdisables forced line preservation on mobile - Centered Text: Text-center alignment with proper spacing
- Responsive: Uses
whitespace-pre-lineandmax-md:whitespace-normalfor long headings
Common Patterns
Standard Content Section
<Section id="features">
<SectionHeader
title={'Everything you need\nto succeed'}
>
{'Pre-built integrations\nand components'}
</SectionHeader>
<div className="grid grid-cols-3 gap-6">
{/* Feature cards */}
</div>
</Section>Long Heading
<SectionHeader
isLongHeading
title={'Trusted by developers around the world'}
>
{'Join thousands of teams\nbuilding with our platform'}
</SectionHeader>Styling
All layout components use Tailwind CSS with custom design tokens:
max-w-8xl- Maximum content widthpx-20 max-md:px-7- Responsive horizontal paddingpy-16 max-md:py-12- Responsive vertical paddinggap-20 max-md:gap-14- Responsive spacing between elementstext-neutral-foreground- Secondary text color
How is this guide ?
Last updated on