Adding a component
This page is for contributing to the default component library in this repository. To add components to your own site, see Custom components.
Default components live in packages/components/src/blocks/. Each is a plain React component registered with Puck via @olgax.com/sdk's registerComponent().
Steps
- Create
src/blocks/YourComponent.tsxwith a typed props interface and aregisterComponent("YourComponent", { fields, defaultProps, render })call. - Add a co-located
YourComponent.cssusing--olgax-*custom properties (seetokens.css) instead of hardcoded colors/spacing. - Import the new file (for its registration side effect) from
packages/components/src/index.ts. - Avoid client-only hooks (
useState, etc.) inrender- Puck components need to work in both the editor (client) and<Render>(can run in a React Server Component).
See CONTRIBUTING.md in the repository root for the full contribution workflow.