# Extending With Widgets The NetlifyCMS exposes an `window.CMS` global object that you can use to register custom widgets, previews and editor plugins. The available widget extension methods are: * **registerWidget** lets you register a custom widget. * **registerEditorComponent** lets you add a block component to the Markdown editor ### Writing React Components inline The registerWidget requires you to provide a React component. If you have a build process in place for your project, it is possible to integrate Although possible, it may be cumbersome or even impractical to add a React build phase. For this reason, NetlifyCMS exposes two constructs globally to allow you to create components inline: ‘createClass’ and ‘h’ (alias for React.createElement). ## `registerWidget` Register a custom widget. ```js CMS.registerWidget(field, control, \[preview\]) ``` **Params:** * **field:** The field type which this widget will be used for. * **control:** A React component that renders the editing interface for this field. Two props will be passed: * **value:** The current value for this field. * **onChange:** Callback function to update the field value. * **preview (optional):** A React component that renders the preview of how the content will look. A `value` prop will be passed to this component. **Example:** ```html ``` ## `registerEditorComponent` Register a block level component for the Markdown editor CMS.registerEditorComponent(definition) **Params** * **definition:** The component definition, must specify: id, label, fields, patterns, fromBlock, toBlock, toPreview **Example:** ```html ``` **Result:** ![youtube-widget](/img/youtube-widget.png)