@olgax.com/components
The default Olgax DXP component library - Hero, Header, Footer, CTA, Gallery, Pricing, FAQ, Testimonials and RelatedPages - with props and theming.
The default, themeable component library for Olgax DXP. Each component is a plain React component registered with Puck
through @olgax.com/sdk, and styled only with --olgax-* CSS variables.
pnpm add @olgax.com/componentsUsage
import { components } from "@olgax.com/components";
import type { Config } from "@puckeditor/core";
export const config: Config = { components };Import the tokens once to get the default theme:
import "@olgax.com/components/dist/tokens.css";Scaffolded sites already do this. Override any --olgax-* property to retheme, or add the optional dark theme:
import "@olgax.com/components/src/themes/dark.css";See Theming.
Common props
Every component also has:
- Color overrides: optional
backgroundColor,primaryColorandtextColorhex values that affect only that instance. - Show to:
everyone,new-visitorsorreturning-visitors.
Components
Each block shows the props Puck stores for it, which is useful when hand-authoring seed data.
{
"type": "Hero",
"props": {
"heading": "Build pages, not pipelines",
"subheading": "A self-hostable page-building layer for Payload + Next.js.",
"ctaLabel": "Get started",
"ctaHref": "/get-started"
}
}RelatedPages
RelatedPages needs a resolver from @olgax.com/datasource, so it does not register
itself on import. Register it from your app:
import { registerRelatedPages } from "@olgax.com/components";
import { createCollectionResolverFetch } from "@olgax.com/datasource";
registerRelatedPages(createCollectionResolverFetch("/api/related-pages"));Editors set collection, filterField, filterValue and limit. items is resolved automatically and read-only.
See Data sources.
Contribute a component
Want to add one to the library? See Default components.
Questions, ideas or something not working?
Ask in our official Discord, open an issue on GitHub, or edit this page.
@olgax.com/sdk
API reference for @olgax.com/sdk - registerComponent, getRegisteredComponents, color override helpers and visitor visibility helpers for Puck components.
@olgax.com/datasource
API reference for @olgax.com/datasource - collectionQueryFields, createCollectionResolverFetch, createCollectionResolver and queryCollectionFromSearchParams.