--- layout: docs title: ComponentRegistry edit_url: "https://github.com/nylas/N1/blob/master/src/component-registry.coffee" ---
The ComponentRegistry maintains an index of React components registered by Nylas packages. Components can use InjectedComponent and InjectedComponentSet to dynamically render components registered with the ComponentRegistry.
Register a new component with the Component Registry.
Typically, packages call this method from their main activate
method
to extend the Nylas user interface, and call the corresponding unregister
method in deactivate
.
This method is chainable.
Argument | Description |
---|---|
component |
Object A React Component with a |
options |
Object: Note that for advanced use cases, you can also pass ( |
Retrieve the registry entry for a given name.
Argument | Description |
---|---|
name |
The String name of the registered component to retrieve. |
Return Values |
---|
Returns a React.Component |
Retrieve all of the registry entries matching a given descriptor.
ComponentRegistry.findComponentsMatching({
role: 'Composer:ActionButton'
})
ComponentRegistry.findComponentsMatching({
location: WorkspaceStore.Location.RootSidebar.Toolbar
})
Argument | Description |
---|---|
descriptor |
An Object that specifies set of components using the available keys below. Note that for advanced use cases, you can also pass ( |
Return Values |
---|
Returns an Array of React.Component objects |