Developer
Documentation
Resources
Get Support
Sign in
Developer
Get Support
Sign in
DOCUMENTATION
Cloud
Data Center
Resources
Sign in
Developer
Sign in
DOCUMENTATION
Cloud
Data Center
Resources
Sign in
Last updated Dec 8, 2017

Theming your gadget dynamically

This page is part of the Gadget Developers' JavaScript Cookbook.

How do I dynamically theme my gadget?

It is possible to have the theme dynamically adapt to the space available with some JavaScript like this:

1
2
action: ...
theme : function () {
  if (gadgets.window.getViewportDimensions().width < 500){
    return "top-label";
  } else{
    return "long-label";
  }
}(),
fields: ...

Gadget Developers' JavaScript Cookbook
Using the Atlassian Gadgets JavaScript Framework

Rate this page: