Syntax/Feature Need: Passable Blocks (as args / other?)
- Dominant language
- No language data
- Stars
- 801
- Forks
- 409
- PR merge metrics
- No merged PRs in 30d
Description
context: https://github.com/emberjs/rfcs/pull/460#issuecomment-902961346
The lack of this capability is a HUGE growing pain for the projects I'm working on and causes a lot of cruft and awkward APIs, and having this feature would simplify _a ton of things_.
For library / ui / design-system authors, having passable blocks would be an _IMMENSE_ lift / relief -- and it _feels_ very surprising that this wasn't talked about more during the original RFC (or maybe it was planned to be added later, and just no one has gotten around to it)
Related thoughts:
- maybe there is a way to:
- reference anything
- pass anything
```hbs
```
```hbs
<:@myBlock>
```
-------------
Example:
the first place this came up was our big table component wrapped with all the bells and whistles.
Here is a more generic, yet very related, example.
A table component
- could yield to="header"
- and yield to="body"
- etc
A wrapper component _cannot_
- optionally yield to="header" and also have that header block be within the table component's header block (and the same for any block).
Like,
```hbs
<:header>
and
```
are not possible APIs.
You can hack around this, by, in the implementation of `WrappedTable`, put an `if` block around the _entirety_ of `Table`, but that's 1. terrible, and 2. does not scale past 1 named block.
I have 7 named blocks in Table component
In order to provide a wrapper table (with nice defaults, optional blocks, etc), I cannot fathom (other than actually doing the math) the amount of code it would take to if-stamement my way through implementing that.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.