Support dynamically adding children to `layout_column_wrap()`
Nobody has claimed this yet.
- Dominant language
- SCSS
- Stars
- 569
- Forks
- 72
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 5
Description
Follow up to #559. This might be an advanced usage, but because layout_column_wrap() wraps each child element in a set of fill-carrying containers, it's less straight-forward than I expected to dynamically add new elements to an existing layout_column_wrap().
The use case would be to set up a wrapping container that will hold an arbitrary number of elements and add to them using insertUI() or something similar. layout_column_wrap() is a good candidate for this because you can effectively give some parameters to the wrapping and sizing of child elements even if you don't know exactly how many will be on the page in advance.
The issue is that children of layout_column_wrap() are wrapped in
<div class="html-fill-container">
<div class="html-fill-item html-fill-container">
<!-- CHILD CONTENTS -->
</div>
</div>
so a naive implementation that just adds new elements to layout_column_wrap() might not work as expected.
One option would be to provide a layout_column_wrap_item() function, or something more generic, e.g. item_wrapped(). I'm not sure. We do now have as_fill(), as_fillable() and as_fill_carrier() functions, but these aren't great either as they each add a layer of nesting.
as_fillable(
div(
as_fill_carrier(
div(
HTML("<!-- CHILD CONTENTS -->")
)
)
)
)
#> <div class="html-fill-container">
#> <div class="html-fill-container html-fill-item">
#> <!-- CHILD CONTENTS -->
#> </div>
#> </div>
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining layout_column_wrap(), its fill-carrying child structure, and how insertUI() adds elements to an existing container. Compare the as_fill(), as_fillable(), and as_fill_carrier() entry points while deciding how dynamically added children should be wrapped; done means arbitrary inserted children retain the intended wrapping and sizing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, r
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100