widgetti / solara

A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps
https://solara.dev
MIT License
1.91k stars 141 forks source link

when classes is passed a string, it is treated as a list #819

Open paddymul opened 1 month ago

paddymul commented 1 month ago

the type for classes is classes: List[str] = []. when it is passed a string, each character is interpreted as a separate class name.

You might want to throw an error for this because it's an easy mistake to make and will lead to unexpected results for users.

For consistency with react, you might want to rename classes as classNames.

Related the solara.Style component is a bit confusingly named. Since the demos only show it accepting a css stylesheet path, I missed that it actually accepts a css string.

You might want to make solara.Stylesheet which inserts a css file. and solara.StyleBlock that accepts css text.