My Fun Component - Builder.io

PHOTO EMBED

Sun Oct 27 2024 13:29:27 GMT+0000 (Coordinated Universal Time)

Saved by @csd3x41

// for example, in my-custom-components.ts 
import { type RegisteredComponent } from "@builder.io/sdk-react";
import { MyFunComponent } from "./MyFunComponent";

export const customComponents: RegisteredComponent[] = [
  {
    component: MyFunComponent,
    // ---> You could also lazy load your component using:
    // component: React.lazy(() => import('./MyFunComponent')),
    name: 'MyFunComponent',
    inputs: [
      {
        name: 'text',
        type: 'string',
        defaultValue: 'Hello world',
      },
    ],
  },
];
content_copyCOPY

https://www.builder.io/c/docs/custom-components-setup