-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Description
I don't think this is something we need to address immediately, but I'm filing it here so that we remember to come back to it.
The functions bind_fill_role()
, as_fillable_container()
, and as_fill_item()
mutate the objects that are passed into them. Here's an example of how this could cause confusing behavior:
from shiny import ui
from shiny.experimental.ui._fill import bind_fill_role
x = ui.div()
y = bind_fill_role(
x,
item=True
)
y.append("Hello")
y
#> <div class="html-fill-item">Hello</div>
# We thought we were just modifying y, but we modified x as well:
x
#> <div class="html-fill-item">Hello</div>
One possible solution that @schloerke and I discussed is to bundle and always include the fill.css file, so that no HTML dependency object is needed, and then simply include the attributes. Here are some possibilities of what the API could look like:
# Use literal class names
ui.div("Hello", class_="html-fill-item")
# Use class name from a variable
ui.div("Hello", class_=ui.FILL_ITEM_CLASS)
# Use function that returns class attributes
ui.div("Hello", fill_item_attrs())
Metadata
Metadata
Assignees
Labels
No labels