WPagesTemplates
Overview
The WPagesTemplates are a set of layout components that provide standardized page structures for the WorkPayCore frontend application. These components offer consistent layouts, navigation patterns, and UI conventions across different pages.
Components
WPPage
A basic page layout component that provides a flexible container for page content with standardized spacing and layout structure.
WPTabbedPage
An advanced page layout component that includes support for tabbed navigation, filters, and data tables with pagination.
WPPageContainer
A modern page container component that provides a clean, structured layout with title, description, and action sections.
When to Use
WPPage
- Use for simple page layouts without complex navigation
- When you need a basic container with consistent spacing
- For pages that don't require tabs or complex filtering
WPTabbedPage
- Use for complex pages with multiple data views
- When you need tabbed navigation with filtering capabilities
- For pages that display data tables with pagination
- When you need tooltips and help text in page titles
WPPageContainer
- Use for modern, clean page layouts
- When you need a consistent header structure with title, description, and actions
- For pages that follow the updated design system patterns
API Documentation
WPPage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| children | ReactNode | ✓ | - | Content to render inside the page |
| ...otherProps | StackProps | - | - | Additional props passed to the root Stack component |
Sub-components
WPPage.BreadCrumb- Breadcrumb navigationWPPage.Title- Page title with optional childrenWPPage.Body- Main content areaWPPage.HeaderSection- Header section with flexible layoutWPPage.RightSection- Right-aligned section with spacerWPPage.LeftSection- Left-aligned section with spacerWPPage.Content- Generic content wrapper
WPTabbedPage
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| children | ReactNode | - | null | Content to render inside the page |
| noFooter | boolean | - | false | Whether to hide the fixed footer |
| pageTitle | string | - | - | Main page title |
| title | string | - | - | Title for tooltip badge |
| fontSize | number | - | 28 | Font size for the page title |
| description | string | - | - | Description text for tooltip |
| hasToolTip | boolean | - | false | Whether to show tooltip icon |
| as | string | - | 'h1' | HTML element type for title |
| color | string | - | 'charcoal' | Color of the page title |
| defaultStatus | string | - | - | Default status for query params |
| ...otherProps | StackProps | - | - | Additional props passed to the root Stack |
Sub-components
WPTabbedPage.BreadCrumb- Breadcrumb navigationWPTabbedPage.Title- Page title with tooltip supportWPTabbedPage.Body- Main content area with tabs supportWPTabbedPage.HeaderSection- Header section for controlsWPTabbedPage.TabsNFilters- Tab navigation with filtersWPTabbedPage.TabList- Tab list componentWPTabbedPage.Filters- Filter components wrapperWPTabbedPage.RightSection- Right-aligned sectionWPTabbedPage.LeftSection- Left-aligned sectionWPTabbedPage.Content- Tab content panelsWPTabbedPage.Table- Data table with multiple variantsWPTabbedPage.FixedFooter- Fixed footer componentWPTabbedPage.AddButton- Standardized add buttonWPTabbedPage.IssueButton- Standardized issue button
WPPageContainer
Props
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| children | ReactNode | ✓ | - | Main content of the page |
| pageTitle | ReactNode | - | - | Page title (string or ReactNode) |
| pageDescription | ReactNode | - | - | Page description text |
| pageActions | ReactNode | - | - | Action buttons or controls |
| BackButton | ReactNode | - | null | Back button component |
| ...rest | StackProps | - | - | Additional props passed to the root VStack |
Sub-components
WPPageContainer.Title- Standardized page titleWPPageContainer.Description- Standardized page description
TypeScript Interfaces
WPPageContainer
type WpPageContainerProps = StackProps & {
children: React.ReactNode;
pageTitle?: React.ReactNode;
pageDescription?: React.ReactNode;
pageActions?: React.ReactNode;
BackButton?: React.ReactNode;
};
interface DescriptionProps extends TextProps {
children: React.ReactNode;
}
Usage Examples
Basic WPPage Usage
import { WPPage } from 'components/WPagesTemplates';
function MyPage() {
return (
<WPPage>
<WPPage.Title title='My Page' />
<WPPage.Body>
<WPPage.Content>{/* Your page content */}</WPPage.Content>
</WPPage.Body>
</WPPage>
);
}
WPTabbedPage with Tabs
import { WPTabbedPage } from 'components/WPagesTemplates';
function MyTabbedPage() {
const tabData = [
{
id: 1,
title: 'Tab 1',
children: <div>Content for tab 1</div>,
},
{
id: 2,
title: 'Tab 2',
children: <div>Content for tab 2</div>,
},
];
return (
<WPTabbedPage pageTitle='My Tabbed Page'>
<WPTabbedPage.Body>
<WPTabbedPage.TabsNFilters tabData={tabData} />
<WPTabbedPage.Content tabData={tabData} />
</WPTabbedPage.Body>
</WPTabbedPage>
);
}
WPTabbedPage with Table
import { WPTabbedPage } from 'components/WPagesTemplates';
function DataPage() {
const columns = [
{ Header: 'Name', accessor: 'name' },
{ Header: 'Email', accessor: 'email' },
];
const data = [{ name: 'John Doe', email: 'john@example.com' }];
return (
<WPTabbedPage pageTitle='Data Table'>
<WPTabbedPage.Body>
<WPTabbedPage.Table
customColumn={columns}
tableData={data}
isLoading={false}
isBasic={true}
noDataMsg='No data available'
/>
</WPTabbedPage.Body>
</WPTabbedPage>
);
}
WPPageContainer Usage
import WPPageContainer from 'components/WPagesTemplates/WPPageContainer';
function ModernPage() {
return (
<WPPageContainer
pageTitle='Modern Page'
pageDescription='This is a modern page layout'
pageActions={<Button>Action Button</Button>}
>
{/* Your page content */}
</WPPageContainer>
);
}
Advanced WPTabbedPage with Filters
import { WPTabbedPage } from 'components/WPagesTemplates';
function AdvancedPage() {
const tabData = [
{
id: 1,
title: 'All Items',
children: <ItemsList />,
},
];
return (
<WPTabbedPage pageTitle='Advanced Page'>
<WPTabbedPage.Body>
<WPTabbedPage.HeaderSection>
<WPTabbedPage.TabsNFilters tabData={tabData}>
<WPTabbedPage.LeftSection>
<FilterComponent />
</WPTabbedPage.LeftSection>
<WPTabbedPage.RightSection>
<Button>Add Item</Button>
</WPTabbedPage.RightSection>
</WPTabbedPage.TabsNFilters>
</WPTabbedPage.HeaderSection>
<WPTabbedPage.Content tabData={tabData} />
</WPTabbedPage.Body>
</WPTabbedPage>
);
}
Integration Patterns
With Breadcrumbs
<WPTabbedPage>
<WPTabbedPage.BreadCrumb>
<HStack as={Link} to='/dashboard'>
<ChevronLeftOutline color='#62A446' />
<Text>Dashboard</Text>
</HStack>
</WPTabbedPage.BreadCrumb>
<WPTabbedPage.Title title='Current Page' />
{/* Rest of content */}
</WPTabbedPage>
With Settings Link
<WPTabbedPage>
<WPTabbedPage.Title
title='Page Title'
direction='row'
justify='space-between'
>
<SettingsLink to='/settings' title='Page Settings' />
</WPTabbedPage.Title>
{/* Rest of content */}
</WPTabbedPage>
With Tooltips
<WPTabbedPage.Title
title='Complex Feature'
hasToolTip={true}
description='This feature helps you manage complex workflows'
/>
Styling
Theme Variables
- Uses
theme.colors.charcoalfor default text color - Uses
theme.colors.greenfor accent colors - Uses
theme.colors.skeletonBorderfor borders - Responsive breakpoints:
theme.breakpoints
Custom Styling
<WPTabbedPage spacing={8} bg='white' p={4}>
<WPTabbedPage.Title
title='Custom Styled Page'
color='blue.500'
fontSize={32}
/>
</WPTabbedPage>
Accessibility
ARIA Support
- Page titles use appropriate heading levels (
h1,h2,h3) - Tooltips include
aria-labelattributes - Tab navigation follows WAI-ARIA guidelines
- Tables include proper table headers and roles
Keyboard Navigation
- Tab key navigates through interactive elements
- Enter/Space activates buttons and links
- Arrow keys navigate between tabs
- Escape key closes modals and tooltips
Screen Reader Support
- Semantic HTML structure with proper headings
- Descriptive text for interactive elements
- Table data is properly structured
- Loading states announced to screen readers
Migration Notes
From WPPage to WPTabbedPage
// Old
<WPPage>
<WPPage.Title title="Page" />
<WPPage.Body>Content</WPPage.Body>
</WPPage>
// New
<WPTabbedPage pageTitle="Page">
<WPTabbedPage.Body>Content</WPTabbedPage.Body>
</WPTabbedPage>
From WPTabbedPage to WPPageContainer
// Old
<WPTabbedPage pageTitle="Page">
<WPTabbedPage.Body>Content</WPTabbedPage.Body>
</WPTabbedPage>
// New
<WPPageContainer pageTitle="Page">
Content
</WPPageContainer>
Best Practices
-
Choose the right component:
- Use
WPPageContainerfor new pages following modern design patterns - Use
WPTabbedPagefor complex data views with tabs and filters - Use
WPPagefor simple layouts without complex navigation
- Use
-
Consistent structure:
- Always provide meaningful page titles
- Use breadcrumbs for navigation hierarchy
- Include loading states for async operations
-
Accessibility:
- Use semantic HTML structure
- Provide descriptive labels for interactive elements
- Test with screen readers
-
Performance:
- Use lazy loading for tab content
- Implement proper pagination for large datasets
- Use React.memo for expensive components
Common Patterns
Settings Pages
<WPTabbedPage>
<WPTabbedPage.BreadCrumb>
<BackButton />
</WPTabbedPage.BreadCrumb>
<WPTabbedPage.Title title='Settings' />
<WPTabbedPage.Body>
<TabsWrapper tabData={settingsTabs} />
</WPTabbedPage.Body>
</WPTabbedPage>
Data Management Pages
<WPTabbedPage pageTitle='Data Management'>
<WPTabbedPage.Body>
<WPTabbedPage.TabsNFilters tabData={dataTabs}>
<WPTabbedPage.LeftSection>
<FilterControls />
</WPTabbedPage.LeftSection>
<WPTabbedPage.RightSection>
<ActionButtons />
</WPTabbedPage.RightSection>
</WPTabbedPage.TabsNFilters>
<WPTabbedPage.Content tabData={dataTabs} />
</WPTabbedPage.Body>
</WPTabbedPage>
Dashboard Pages
<WPTabbedPage pageTitle='Dashboard'>
<WPTabbedPage.Body>
<Stack spacing={8}>
<StatsCards />
<ChartsSection />
<RecentActivity />
</Stack>
</WPTabbedPage.Body>
</WPTabbedPage>