Skip to Content

SAPUI5 - add image/icon to radiobutton control (custom)

I need to show an image for every radio button in a radio button group.

I've seen a few examples of custom radiobuttons and radiobuttongroups, but none of them working.

Could someone please point me in the right direction?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 23, 2017 at 06:22 AM

    Hello, Adam Harkus. As far as I know the lasted version of UI5 1.48 radio button and radio button group still doesn't support this functionality. So I suggest that you should try to use radio button and button work together. Please check the code below, Hopefully, It will face your requirement.

    <m:VBox >
    	<m:HBox >
    		<m:RadioButton groupName="GroupA" selected="true" />
    		<m:Button icon="sap-icon://trend-up" iconFirst="true" width="auto" editable="false" enabled="true" visible="true" iconDensityAware="false" />    
    	</m:HBox>
    	<m:HBox >
    		<m:RadioButton groupName="GroupA"  />
    		<m:Button icon="sap-icon://filter"
    			iconFirst="true" width="auto" enabled="true" visible="true"
    				iconDensityAware="false" />	
    	</m:HBox>
    	<m:HBox >
    		<m:RadioButton groupName="GroupA"  />
    		<m:Button icon="sap-icon://add"
    			iconFirst="true" width="auto" enabled="true" visible="true"
    				iconDensityAware="false" />	
    	</m:HBox>
    </m:VBox>
    
    Add comment
    10|10000 characters needed characters exceeded

  • Nov 23, 2017 at 06:50 AM

    Hey Adam,

    If all fails, you can always wrap it in a container/class/div etc. and edit the css of the radio buttons like so.

    Add comment
    10|10000 characters needed characters exceeded