Simple, safe, and pythonic custom styling

Hey! After tinkering with different hacks to inject CSS in a scoped, safe way into streamlit, I think I found a really nice (although still somewhat hacky) way to create scoped CSS rules. I packaged it all into a minimalistic styling library.

Check out a simple demo app: https://st-vibe.streamlit.app.

Any recommendation on either interesting features, or how to make the CSS injection more robust are super welcomed!

3 Likes

Hey Apiad,

That’s an awesome piece you work you did ! I am often struggling with css so I guess this will help me a lot.
When you say it is “still somewhat hacky”, what do you mean ? I feel like targeting element with :has() is quite powerful, and it would need a deep html modification from Streamlit to break it, wouldn’it ?

Anyway, many thaks for tis library, I will definitely give it a try !

Cheers,

Anthony

1 Like