Skip to content

Commit f97552e

Browse files
committed
Revert "Don't set inline styles in output_widget() (widgets have their own Layout() API that gets used to set inline styles on child elements)"
This reverts commit eecd9f3.
1 parent eecd9f3 commit f97552e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ipyshiny/_ipyshiny.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
) # pyright: reportMissingTypeStubs=false, reportUnknownVariableType=false
1717
from ipywidgets._version import __protocol_version__
1818

19-
from htmltools import tags, Tag, TagList
19+
from htmltools import tags, Tag, TagList, css
2020
from htmltools._util import _package_dir
2121
from shiny import event, reactive
2222

@@ -29,12 +29,19 @@
2929
from ._comm import ShinyComm, ShinyCommManager, BufferType
3030

3131

32-
def output_widget(id: str) -> Tag:
32+
def output_widget(
33+
id: str, *, width: str = "100%", height: str = "400px", inline: bool = False
34+
) -> Tag:
35+
# TODO: we should probably have a way to customize the container tag, like you can
36+
# in htmlwidgets
3337
return tags.div(
3438
*libembed_dependency(),
3539
output_binding_dependency(),
3640
id=id,
3741
class_="shiny-ipywidget-output",
42+
style=css(
43+
width=width, height=height, display="inline-block" if inline else None
44+
),
3845
)
3946

4047

0 commit comments

Comments
 (0)