Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
sohaibahsan007
Frequent Visitor

How to set Different Style on each actionButton using JSON theme?

I have a problem, where I'm trying to create a Dashboard using power bi js SDK, Power BI only allow to format some properties, but not all of them, Issues, I'm facing is:

  1. not able to set an image on image visual 
  2. not able to set an image on action button Fill Property, I'm able to set using JSON theme, but it gets applies on all of the action buttons, but I want them separately, 
  3. is there any way, so I can set the style in the JSON theme using a visual name that is provided to create of new visual?.
  4. would be helpful if I can know, how to set an image on image visual via power API, or how to set an image on action button using powerBI API.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @sohaibahsan007,

Here is the code snap of the 'action button' JSON theme configuration that I found at the below link, you can check if helps:

 

{
    "name": "Theme Example of Action Buttons",
    "actionButton": {
        "*": {
            "border": [{
                "show": false
            }],
            "visualHeader": [{
                "show": false
            }],
            "background": [{
                "show": false
            }],
            "title": [{
                "show": false
            }],
            "outline": [{
                    "show": true
                },
                {
                    "$id": "default",
                    "weight": 0
                },
                {
                    "$id": "hover",
                    "weight": 0
                },
                {
                    "$id": "selected",
                    "weight": 0
                }
            ],
            "fill": [{
                    "show": true
                },
                {
                    "$id": "default",
                    "transparency": 0,
                    "fillColor": {
                        "solid": {
                            "color": "#25476E"
                        }
                    }
                },
                {
                    "$id": "hover",
                    "transparency": 0,
                    "fillColor": {
                        "solid": {
                            "color": "#386AA5"
                        }
                    }
                },
                {
                    "$id": "selected",
                    "transparency": 0,
                    "fillColor": {
                        "solid": {
                            "color": "#4A8DDC"
                        }
                    }
                }
            ],
            "icon": [{
                    "show": true
                },
                {
                    "$id": "default",
                    "lineColor": {
                        "solid": {
                            "color": "#FFFFFF"
                        }
                    }
                },
                {
                    "$id": "hover",
                    "lineColor": {
                        "solid": {
                            "color": "#FFFFFF"
                        }
                    }
                },
                {
                    "$id": "selected",
                    "lineColor": {
                        "solid": {
                            "color": "#FFFFFF"
                        }
                    }
                }

            ]
        }
    }
}

 

Solved: actionButton Power BI JSON Theme - Page 2 - Microsoft Power BI Community

AFAIK, power bi theme does not work with custom visuals. If you mean setting the image in the 'action button', please check and modify the background properties as below sample.

 

"background": [{
        "image": {
            "name": "xxxx",
            "scaling": "Fit",
            "url": "Put your Base64 code here"
        },
        "transparency": 50
    }]

 

Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

HI @sohaibahsan007,

AFAIK, current power bi does not support the setting of different styles on the action button based on JSON theme settings. You can configure with JSON theme but it does not allow setting a list of style collections.

Regards,

Xiaoxin Sheng

@Anonymous Thank you for the help, Can you please help with the last point, 
How to Set an Image on Image Visual using Power BI JS SDK?. 

Anonymous
Not applicable

HI @sohaibahsan007,

Here is the code snap of the 'action button' JSON theme configuration that I found at the below link, you can check if helps:

 

{
    "name": "Theme Example of Action Buttons",
    "actionButton": {
        "*": {
            "border": [{
                "show": false
            }],
            "visualHeader": [{
                "show": false
            }],
            "background": [{
                "show": false
            }],
            "title": [{
                "show": false
            }],
            "outline": [{
                    "show": true
                },
                {
                    "$id": "default",
                    "weight": 0
                },
                {
                    "$id": "hover",
                    "weight": 0
                },
                {
                    "$id": "selected",
                    "weight": 0
                }
            ],
            "fill": [{
                    "show": true
                },
                {
                    "$id": "default",
                    "transparency": 0,
                    "fillColor": {
                        "solid": {
                            "color": "#25476E"
                        }
                    }
                },
                {
                    "$id": "hover",
                    "transparency": 0,
                    "fillColor": {
                        "solid": {
                            "color": "#386AA5"
                        }
                    }
                },
                {
                    "$id": "selected",
                    "transparency": 0,
                    "fillColor": {
                        "solid": {
                            "color": "#4A8DDC"
                        }
                    }
                }
            ],
            "icon": [{
                    "show": true
                },
                {
                    "$id": "default",
                    "lineColor": {
                        "solid": {
                            "color": "#FFFFFF"
                        }
                    }
                },
                {
                    "$id": "hover",
                    "lineColor": {
                        "solid": {
                            "color": "#FFFFFF"
                        }
                    }
                },
                {
                    "$id": "selected",
                    "lineColor": {
                        "solid": {
                            "color": "#FFFFFF"
                        }
                    }
                }

            ]
        }
    }
}

 

Solved: actionButton Power BI JSON Theme - Page 2 - Microsoft Power BI Community

AFAIK, power bi theme does not work with custom visuals. If you mean setting the image in the 'action button', please check and modify the background properties as below sample.

 

"background": [{
        "image": {
            "name": "xxxx",
            "scaling": "Fit",
            "url": "Put your Base64 code here"
        },
        "transparency": 50
    }]

 

Regards,

Xiaoxin Sheng

Hello! Thanks for your help, is there a way to add a custom font in this code?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors