Programatically add css via datasets



I have built a dataset that has an ‘OK’ or ‘FAILED’ state. I’d love to apply green or red to the widget depending on the state.
Is there any way I can send information over, css classNames or colours via datasets that can then be applied to a dataset html element/container and then I can add in css classNames in the theme?

Or indeed any other way of doing this?



Hey @MrBen,

This isn’t specifically possible via the Datasets API, but there are some ways I’ve seen where the custom CSS applied to the dashboard has selectors for classes that are only available when the widget is in a certain state, e.g. when a Geck-o-meter has reached it’s goal. I’ll need to dig around to find some good examples and get back to you, however it can be quite hacky or may not work specifically for your use case of e.g. the ‘OK’ or ‘FAILED’ state. That said, could you share more about your setup - i.e. the data you’re pushing, the visualizations, etc.?



As a first pass I ended up building this as a text widget circleci-geckoboard-status mainly because datasets don’t support html or classNames.

My original dataset work can be seen circleci-geckoboard-status-dataset. Its working, but needs finishing off.

Ideally it would be great to be able to send a className into the dataSet to then style a row dependant on OK or FAILED state.


Hey @MrBen, the text widget is quite cool! As far as sending styling, I’ve shared this feedback with our Product team. It’s something that we’ve heard from time to time and something we’re not opposed to, but hasn’t yet been a priority or precisely fit our current direction. So I am not sure when we might add a feature like that, I’m afraid.

Thanks again for sharing your workaround - it’s quite nice. If I find any news about being able to send styling via the API I’ll let you know.