Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Color of Widget based on Data #114

Closed
alexcurtin opened this issue Jun 13, 2017 · 2 comments
Closed

Change Color of Widget based on Data #114

alexcurtin opened this issue Jun 13, 2017 · 2 comments

Comments

@alexcurtin
Copy link

How would I go about changing the color of 1 single widget depending on data sent to that widget, since they share css classes?

@zorbash
Copy link
Member

zorbash commented Jun 16, 2017

@alexcurtin did you get an answer for this?

@davejlong
Copy link
Member

davejlong commented Jun 19, 2017

Don't know how I closed this. Anyways, the class of a widget can be overriden from the JS widget. An example of this can be found in the Text widget. The value of status from the data source will be used as an additional class applied to the widget.

So passing data to the Text widget like {text: "Something awesome happened!", status: "success"} will set success as an additional class on the widget and in your CSS you can add something like:

.widget-text.success {
   background-color: green;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants