2015-10-03 01:57:40 +08:00
---
layout: docs
title: InjectedComponentSet
2015-10-04 04:56:58 +08:00
edit_url: "https://github.com/nylas/N1/blob/master/src/components/injected-component-set.cjsx"
2015-10-03 01:57:40 +08:00
---
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
< h2 > Summary< / h2 >
2015-10-02 03:34:16 +08:00
2015-10-03 01:57:40 +08:00
< div class = "markdown-from-sourecode" >
< p > < p > InjectedComponent makes it easy to include a set of dynamically registered
2015-10-02 03:34:16 +08:00
components inside of your React render method. Rather than explicitly render
an array of buttons, for example, you can use InjectedComponentSet:< / p >
< pre > < code class = "lang-coffee" > < InjectedComponentSet className=< span class = "hljs-string" > "message-actions"< / span >
matching={< span class = "hljs-string" > role:< / span > < span class = "hljs-string" > 'ThreadActionButton'< / span > }
exposedProps={< span class = "hljs-string" > thread:< / span > < span class = "hljs-annotation" > @props< / span > .thread, < span class = "hljs-string" > message:< / span > < span class = "hljs-annotation" > @props< / span > .message}>
< / code > < / pre >
< p > InjectedComponentSet will look up components registered for the location you provide,
2015-10-03 01:57:40 +08:00
render them inside a < a href = 'flexbox.html' > Flexbox< / a > and pass them < code > exposedProps< / code > . By default, all injected
children are rendered inside < a href = 'unsafecomponent.html' > UnsafeComponent< / a > wrappers to prevent third-party code
2015-10-02 03:34:16 +08:00
from throwing exceptions that break React renders.< / p >
< p > InjectedComponentSet monitors the ComponentRegistry for changes. If a new component
is registered into the location you provide, InjectedComponentSet will re-render.< / p >
< p > If no matching components is found, the InjectedComponent renders an empty span.< / p >
< / p >
< / div >
2015-10-03 01:57:40 +08:00
< ul >
< / ul >
< h3 > Class Properties< / h3 >
< h4 id = propTypes > propTypes < a href = "#propTypes" class = "link" > < / a > < / h4 >
< p > < p > React < code > props< / code > supported by InjectedComponentSet:< / p >
< / p >
< table class = "arguments" >
< tr >
< td style = "width:15%;" >
< em > matching< / em >
< / td >
< td >
2015-10-04 04:56:58 +08:00
2015-10-03 01:57:40 +08:00
< p > Pass an < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object' > Object< / a > with ComponentRegistry descriptors This set of descriptors is provided to < a href = 'ComponentRegistry.html#findComponentsForDescriptor' > ComponentRegistry::findComponentsForDescriptor< / a > to retrieve components for display.< / p >
2015-10-04 04:56:58 +08:00
2015-10-03 01:57:40 +08:00
< / td >
< / tr >
< tr >
< td style = "width:15%;" >
< em > className< / em >
< / td >
< td >
< span class = "optional" > Optional< / span >
< p > A < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string' > String< / a > class name for the containing element.< / p >
2015-10-04 04:56:58 +08:00
2015-10-03 01:57:40 +08:00
< / td >
< / tr >
< tr >
< td style = "width:15%;" >
< em > children< / em >
< / td >
< td >
< span class = "optional" > Optional< / span >
< p > Any React elements rendered inside the InjectedComponentSet will always be displayed.< / p >
2015-10-04 04:56:58 +08:00
2015-10-03 01:57:40 +08:00
< / td >
< / tr >
< tr >
< td style = "width:15%;" >
< em > exposedProps< / em >
< / td >
< td >
< span class = "optional" > Optional< / span >
< p > An < a href = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object' > Object< / a > with props that will be passed to each item rendered into the set.< / p >
2015-10-04 04:56:58 +08:00
2015-10-03 01:57:40 +08:00
< / td >
< / tr >
< tr >
< td style = "width:15%;" >
< em > containersRequired< / em >
< / td >
< td >
< span class = "optional" > Optional< / span >
< p > . Pass false to optionally remove the containers placed around injected components to isolate them from the rest of the app.< / p >
2015-10-04 04:56:58 +08:00
2015-10-03 01:57:40 +08:00
< / td >
< / tr >
< tr >
< td style = "width:15%;" >
< em > < / em >
< / td >
< td >
2015-10-04 04:56:58 +08:00
2015-10-03 01:57:40 +08:00
< p > Any other props you provide, such as < code > direction< / code > , < code > data-column< / code > , etc. will be applied to the < a href = 'flexbox.html' > Flexbox< / a > rendered by the InjectedComponentSet.< / p >
2015-10-04 04:56:58 +08:00
2015-10-03 01:57:40 +08:00
< / td >
< / tr >
< / table >