The @chaibuilder/sdk
is the core foundation of the ChaiBuilder ecosystem. It is a pure React-based website builder that provides all the essential tools and components needed to create and customize websites visually using React and Tailwind CSS.
pnpm add @chaibuilder/sdk
To implement the ChaiBuilder SDK in your React application:
import "./chaibuilder.tailwind.css";
import "@chaibuilder/sdk/styles";
import {loadWebBlocks} from "@chaibuilder/sdk/web-blocks";
import { ChaiBuilderEditor } from "@chaibuilder/sdk";
loadWebBlocks();
const BuilderFullPage = () => {
return (
<ChaiBuilderEditor
blocks={[{
_type: 'Heading',
_id: 'a',
content: 'This is a heading',
styles: '#styles:,text-3xl font-bold'
}]}
onSave={async ({ blocks, theme } ) => {
console.log(blocks, theme);
return true
}}
/>
);
}
One of the key features of the SDK is the ability to render built pages as both HTML and React components:
import {RenderChaiBlocks} from "@chaibuilder/sdk/render";
import type { ChaiType } from "@chaibuilder/sdk";
// Example in NextJS page.tsx
export default async function Page () => {
// implement your function
const pageblocks: ChaiBlock[] = await getPageBlocks();
return <RenderChaiBlocks blocks={pageBlocks} />
}
The SDK allows you to extend its functionality by adding custom blocks. Also the builder allows you to add/overwrite certain functionality via our extension apis.
The ChaiBuilder SDK is open source and available on GitHub. Contributions from the community are welcome.
Made with Chai Builder