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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.