import solara
import ipywidgets as widgets
import markdown
from ipywidgets import HTML
html = markdown.markdown("""# Markdown""")
the_HTML = HTML(html) # markdown as widget based on https://github.com/jupyter-widgets/ipywidgets/issues/2428#issuecomment-500084610
# reactive variables will trigger a component rerender
# when changed.
# When you change the default (now 0), hit the embedded browser
# refresh button to reset the state
clicks = solara.reactive(0)
but1 = widgets.RadioButtons(options=["foo", "bar"])
check1 = widgets.Checkbox(description="asdf", indent=False)
check2 = widgets.Checkbox(description="verylongstringherethisislong", indent=False)
box_layout = widgets.Layout(
align_items='flex-start',
width='1300px',
justify_content='flex-start'
)
#the_HTML.value("<p>Go away!</p>") # change value based on https://stackoverflow.com/a/55550657/8508004
# Solara also supports ipywidgets
# remove the Page component and assign an ipywidget to
# the page variable, e.g.
vbox = widgets.VBox(
children=[
widgets.HBox(children=[but1,], layout=box_layout),
the_HTML,
#solara.Markdown(f"**Button color**:{clicks} "), # based on https://github.com/paddymul/buckaroo/blob/main/example-notebooks/Solara-Buckaroo.ipynb
widgets.HBox(children=[check2, check1], layout=box_layout)
]
)
page = vbox