posit-dev / py-faicons

An interface to Font Awesome for use in PyShiny
MIT License
5 stars 1 forks source link

Make icons look better in value boxes #8

Closed cpsievert closed 10 months ago

cpsievert commented 10 months ago

This PR makes icon_svg() look much better inside a shiny value_box(), for example:

import faicons as fa
from shiny.express import ui

with ui.value_box(showcase=fa.icon_svg("gear")):
    "A value box"
    "With a value"

Before

Screenshot 2023-12-28 at 5 29 55 PM

After

Screenshot 2023-12-28 at 5 29 35 PM

It does this by including a class="fa" to the <svg> markup, which {bslib} will recognize as a fontawesome icon, and thus add the gradient and font-size style.