--- title: UI-Extensions subtitle: How to extend the SCM-Manager UI with plugins --- UI-Extensions contains the building blocks for the [SCM-Manager](https://scm-manager.org) ui extension system. ## Extensions and ExtensionPoints Extension points are spots in the ui, where the ui could be extended or modified. An extension point requires a unique name and is represented as [React](https://reactjs.org/) component. Example: ```xml

Repository

``` We can register an extension, in the form of a [React](https://reactjs.org/) component, to the "repo.details" extension point, by using the binder: ```javascript import { binder } from "@scm-manager/ui-extensions"; const Rtfm = () => { return Read the f*** manual; }; binder.bind("repo.details", Rtfm); ``` The ExtensionPoint will now find and render the Rtfm component. ### Render multiple extensions An extension point can render multiple extensions at one. This can be done with the renderAll parameter: ```javascript

Repository

``` Now we can bind multiple components to the same extension point. ```javascript const Rtfm = () => { return Read the f*** manual; }; const RealyRtfm = () => { return

Read the f*** manual

; }; binder.bind("repo.details", Rtfm); binder.bind("repo.details", RealyRtfm); ``` ### Passing props to extensions An extension point author can pass React properties to the extensions. This can be done with the `props` property: ```javascript
``` The extension becomes now the defined react properties as input: ```javascript const Title = (props) => { return

Repository {props.name}

; }; binder.bind("repo.title", Title); ``` ### Defaults An ExtensionPoint is able to render a default, if no extension is bound to the ExtensionPoint. The default can be passed as React children: ```javascript

Default Title

``` ### Conditional rendering An extension can specify a predicate function to the binder. This function becomes the props of the ExtensionPoint as input and only if the predicate returns true the extension will be rendered: ```javascript const GitAvatar = () => { return git avatar; }; binder.bind("repo.avatar", GitAvatar, (props) => props.type === "git"); ``` ```javascript ```