Skip to Content
ReferencePage Components

Page Components

Page components define the main content area for each page of a trainer’s website. They sit between the Header and Footer and are responsible for the page layout, content display, and user interactions.

Required pages

Every template must include these three pages:

PageComponentPurpose
HomeHomeContentLanding page — hero section, highlights, call-to-action
AboutAboutContentTrainer bio, qualifications, story
LoginLoginContentAuthentication form for clients

Optional pages

Include any of these to make your template more comprehensive. Templates with more pages are more attractive to buyers.

PageComponentDescription
ServicesServicesContentList of training services with descriptions and pricing
BlogBlogContentBlog post listing with cards, pagination
TestimonialsTestimonialsContentClient reviews and success stories
PricingPricingContentPricing tiers and plan comparison
ScheduleScheduleContentSession booking calendar
EventsEventsContentUpcoming events, workshops, group sessions
ContactContactContentContact form and trainer details
PrivacyPrivacyContentPrivacy policy page
TermsTermsContentTerms of service page
TransformationsTransformationsContentBefore/after client transformation gallery
AccountAccountContentLogged-in client’s account dashboard
JoinJoinContentNew client registration form
Forgot PasswordForgotPasswordContentPassword reset request form
Verify EmailVerifyEmailContentEmail verification status page
Reset PasswordResetPasswordContentNew password entry form

Export pattern

All page components use default exports:

export default function HomeContent() { const { clientName, t, localePath } = useApp() return ( <main> <h1>{t('welcomeTo')} {clientName}</h1> {/* page content */} </main> ) }

Then re-export from your barrel file (index.ts):

export { default as HomeContent } from './pages/home/HomeContent'

Page builder integration

If your template supports the page builder, page components can export a RenderBuilderSection named export alongside the default export:

import styles from './HomeContent.module.css' import { useApp } from '@/hooks/useApp' interface BuilderSection { id: string type: string content: Record<string, unknown> } export function RenderBuilderSection({ section }: { section: BuilderSection }) { switch (section.type) { case 'hero': return <section className={styles.hero}>{/* render hero */}</section> case 'features': return <section className={styles.features}>{/* render features */}</section> case 'cta': return <section className={styles.cta}>{/* render CTA */}</section> default: return null } } export default function HomeContent() { const { t } = useApp() return <main>{/* default layout */}</main> }

RenderBuilderSection is optional. It enables trainers to customise their page layout using the Gymlium drag-and-drop page builder. If you don’t export it, the trainer sees only your default layout.

Available props and hooks

Page components receive no props directly. Instead, use the provided hooks to access all the data you need:

const { locale, // Current locale code (e.g. "en", "ar") isRtl, // Whether current locale is RTL t, // Translation function: t('key') localePath, // Locale-prefixed path: localePath('/about') clientName, // Trainer's business name locales, // Array of enabled locale codes plan, // Trainer's subscription plan planLimits, // Feature limits for the plan stats, // Site statistics (post count, etc.) registrationOpen // Whether client registration is enabled } = useApp()

See Hooks & Context for full documentation of each hook’s return values.

File organisation

Each page lives in its own directory under pages/:

pages/ ├── home/ │ ├── HomeContent.tsx │ ├── HomeContent.module.css │ └── components/ # Optional sub-components │ ├── HeroSection.tsx │ └── HeroSection.module.css ├── about/ │ ├── AboutContent.tsx │ └── AboutContent.module.css └── services/ ├── ServicesContent.tsx └── ServicesContent.module.css

You can create sub-components within a page directory. Only the main *Content.tsx file needs to be exported from the barrel file — sub-components are imported internally by the page component.

Last updated on