Is there a way to add/display bloxs in streamlit?

How to use bloxs in streamlit?

From furas’ answer in this duplicate question on Stackoverflow:

Use B(...)._repr_html_() to get it as HTML and put it in streamlit using HTML component.

But HTML component can’t detect its height and you have to set it manually.

import streamlit as st
import streamlit.components.v1 as components
from bloxs import B

st.title('Bloxs example in Streamlit')

item = B([
    B(1999, "Percent change!", percent_change=10),
    B("πŸŽ‰πŸŽ‰πŸŽ‰", "Works with emojis"),
    B("68%", "Loading progress", progress=68),
    B(1234, "Bloxs in notebook!")
])._repr_html_()

components.html(item, height=300) #, scrolling=True)

enter image description here

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.