Here 3 ways to easily and quickly improve the look of an button in your R Shiny app:

  1. Use a CSS Bootstrap class.
  2. Add a Font Awesome Icon.
  3. Change the theme of your R Shiny app.

1. Use a CSS Bootstrap class

As the CSS Boostrap library is a dependency of Shiny, you can simply add a Bootstrap class inside the actionButton() function using the class argument, such as “btn-primary”, “btn-info”, “btn-danger” or “btn-success”. They classes will change the color of the button. You can also easily change the size of the button by adding “btn-lg” or “btn-sm”.

2. Add a Font Awesome Icon

You can also add an icon from the library “Font Awesome” or “Glyphicon” using the icon() function, for example the icons “download” or “refresh”.

Add a Font Awesome Icon

3. Change the theme of your R Shiny app

You can change the default color palette by using the {bslib} R package to change your R Shiny theme. You can choose for example the Bootswatch themes “cerulean”, “minth” or “united”.

You can even create you own palette by customizing the colors in the bs_theme() function, for example by making the success button of color “lightgreen” or the danger the color “coral”.

Conclusion

I hope you found this content useful. If you want to download the R code of this tutorial, you can get it by joining my newsletter on felixanalytix.com.

Don’t forget to clap and subscribe. And I see you in another article! 😊

--

--

Data Scientist, felixanalytix.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store