The component configuration object.
Returns
AComponentCallable that serves as both the component’s default export and a callable function. When called with props, it creates an instance of the component. The returned value also carries the metadata, properties, thumbnail, and previews for the Composer to read.
Usage
Minimal component
With properties
With metadata and previews
With children
With thumbnail
Notes
- The
bodyfunction is called on every re-render. Avoid expensive computations inside it, or use hooks like useState to cache values. Self()is available insidebodyand inpreviewsto create instances of the component being defined. Props passed toSelf()are typed based on thepropertiesschema.- The component must be assigned to
exports.defaultto be recognized by the BindJS runtime. - Properties can also be defined as a factory function
() => Record<string, PropertyField>for dynamic schema generation.
See Also
- defineButtonStyle — for defining custom button styles
- useState — component-local state
- useStore — global shared state