The previous reply may be out-to-date.
There is an accepted RFC for this problem; the Named Templates Block API will support passing multiple blocks to a component.
As of Ember 2.3, Contextual components allows another approach to this case:
Split your component into multiple subcomponents and pass the subcomponents back to the component as block parameters; this setup allows to set the content of each subcomponent block.
Check out the Twiddle - full example.
// my-component.js
{{yield (hash
header = (component 'my-header')
content = (component 'my-content')
footer = (component 'my-footer')
)}}
{{#unless hasBlock}}
{{my-header}}
{{my-content}}
{{my-footer}}
{{/unless}}
// my-{header/content/footer}.js
{{#if hasBlock}}
{{yield}}
{{else}}
Default xxxxx
{{/if}}
In this case, you could use the default component content or pass the specific content to any subcomponent like:
{{my-component}}
{{#my-component as |f|}}
{{f.header}}
{{#f.content}}
Custom content
{{/f.content}}
{{f.footer}}
{{/my-component}}
{{#my-component as |f|}}
{{#f.header}}
Custom header
{{/f.header}}
{{#f.content}}
Custom content
{{/f.content}}
{{#f.footer}}
Custom footer
{{/f.footer}}
{{/my-component}}
This solution does not force the component API/structure, then the component could be wrongly used if a subcomponent is omitted, added multiple times, or have the wrong order, in these cases the component will generate an undesired content.
Check out the Twiddle - full example.
ember-truth-helpers
addon, you can use{{yield 'header'}}
in the component template and then{{#if (eq section 'header')}}
in the consumer template. – Alleviator