Layout Components
Relevant source files This document provides API reference and construction patterns for layout components in@ui8kit/core. Layout components orchestrate multiple UI components into complete application structures such as dashboards, landing pages, and admin panels.
For basic primitive layout components (Grid, Flex, Stack), see Core Components. For UI component composition patterns, see UI Components. For general best practices on layout construction, see Best Practices.
Overview
The library provides three specialized layout components that compose primitives and UI components into application templates:| Component | Purpose | Primary Use Case |
|---|---|---|
DashLayout | Dashboard layout with resizable sidebar | Admin panels, dashboards |
LayoutBlock | Flexible content sections with grid/flex/stack modes | Landing pages, marketing sites |
SplitBlock | Two-column split layouts | Feature sections, hero sections |
Component Relationships
DashLayout
Dashboard layout component with resizable sidebar, navbar, and main content area. Built onreact-resizable-panels for panel resizing functionality.
DashLayout Props
| Prop | Type | Default | Description |
|---|---|---|---|
page | React.ComponentType | - | Component to render in main content area |
children | React.ReactNode | - | Alternative to page prop for main content |
sidebar | React.ReactNode | - | Content for resizable sidebar |
navbarProps | Partial<NavbarProps> | - | Props for navbar including brand, theme toggle |
Navbar Sub-component
<nav> element with data-role="dash-navbar" attribute.
Implementation: src/layouts/DashLayout.tsx34-49
Sidebar Sub-component
<aside> element. Wraps children in Stack layout with optional title.
Implementation: src/layouts/DashLayout.tsx14-25
Panel Structure
Import Pattern
LayoutBlock
Flexible content section component supporting three layout modes: grid, flex, and stack. Includes content hook system for customizable rendering and default presenters for common patterns.LayoutBlock Props
Layout Modes
| Mode | Component | Use Case | Props |
|---|---|---|---|
grid | Grid | Feature grids, card galleries | cols, gridCols, gap, align, justify |
flex | Group | Flexible wrapping layouts | wrap, flexWrap, gap, align, justify |
stack | Stack | Vertical lists, timelines | stackAlign, gap |
Content Hook System
| Hook Set | Layout Mode | Item Renderer | Use Case |
|---|---|---|---|
defaultLayoutContentHooks.gridCards | grid | DefaultItemRenderers.gridCard | Card-based grids with images |
defaultLayoutContentHooks.gridSimple | grid | DefaultItemRenderers.gridSimple | Simple icon + text grids |
defaultLayoutContentHooks.flex | flex | DefaultItemRenderers.flexItem | Horizontal feature lists |
defaultLayoutContentHooks.stack | stack | DefaultItemRenderers.flexItem | Vertical feature lists |
Default Item Renderers
Import Pattern
SplitBlock
Two-column split layout component for hero sections and feature showcases. Supports left/right media positioning and optional container wrapping.SplitBlock Props
Layout Modes
| Mode | Description | Structure |
|---|---|---|
splitSection={false} | Contained layout | Block > Container > Grid(cols="1-2") |
splitSection={true} | Full-width layout | Block > Grid(cols="1-2") |
Content Hook System
Import Pattern
Construction Patterns by Use Case
Landing Pages
Landing pages typically combine multipleLayoutBlock and SplitBlock components for hero sections, features, and CTAs.
Dashboards
Dashboards useDashLayout as the primary container with resizable sidebar for navigation.
Websites
Multi-page websites composeLayoutBlock sections with different layout modes for varied content types.
Admin Panels
Admin panels extend the dashboard pattern with form layouts and data management interfaces.Common Composition Patterns
Responsive Grid Configurations
| Use Case | Cols Value | Description |
|---|---|---|
| Feature grid | "1-2-3" | 1 column mobile, 2 tablet, 3 desktop |
| Stat cards | "1-2-4" | 1 column mobile, 2 tablet, 4 desktop |
| Two-column | "1-2" | 1 column mobile, 2 desktop |
| Simple grid | "2" | Always 2 columns |
Content Hook Composition
Nested Layout Composition
Data Attributes for Targeting
Layout components includedata-class and data-role attributes for consistent DOM targeting:
| Component | Attribute | Value | Element |
|---|---|---|---|
DashLayout | data-role | "dash-main" | Main content block |
Navbar | data-role | "dash-navbar" | Nav element |
Sidebar | data-role | "dash-sidebar-stack" | Stack container |
LayoutBlock | data-class | "layout-block" | Section element |
LayoutBlock | data-class | "layout-grid" / "layout-flex" / "layout-stack" | Layout container |
SplitBlock | data-class | "split-grid" | Grid container |