registerComponent(name, component)

Registers the React component with the given name, so it can be used as a Scrivito extension. 

Copy
Scrivito.registerComponent("SocialMediaTab", props => (
  <h1>{props.page.get("title")}</h1>
));

See also the section about using Scrivito extensions in properties views, or take a look at our tutorial about customizing page and widget property editing

Params

  • name (String)  – Name of the component, e.g. "SocialMediaTab".
  • component (Function) – A React component. The component instances will receive a Scrivito-specific prop: page, widget or obj.

Props

  • page (Obj) – The page. This prop is set for content classes based on Obj. It is only present if the component is used as an extension to the properties view of a page.
  • widget (Widget) – The widget instance for which the component is rendered. It is only present if the component is used as an extension to the properties view of a Widget.
  • obj (Obj) – The CMS object. This prop is set for content classes based on Obj. It is only present if the component is used as an extension to the properties view of an Obj, which is not a page, e.g. an image.