Skip to main content
10-Marble
Jun 8, 2022 7:07 PM UTC
Solved

icon size limited on button widget without label

When creating a button with only an icon/ image displayed on it I find that the icon can only be enlarged to so far before it exceeds some allowable area.

With a blank label the icon, sized here to 100x100 pixels, becomes cropped. 

NS_YSmartLab_1-1654714821364.png

With a label the icon is properly sized.

NS_YSmartLab_2-1654714917764.png

Is there a way to get image only buttons to have their icons properly sized without this cropping?

Nate_145Answer
10-Marble
Jul 23, 2024 4:58 PM UTC

The problem is solved! See https://www.ptc.com/en/support/article/CS420114

 

The following custom CSS should solve the issue of incorrectly formatted icon only buttons. Please adjust as appropriate for padding and allowable image size.

 

ptcs-button[mode="icon"]::part(root) {
padding: 10px;
max-width: 100px;
max-height: 100px;
}

7 replies

15-Moonstone
Jun 10, 2022 5:31 AM UTC

@Nate_145 : Please try with https://www.ptc.com/en/support/article/CS328540 

While using this, you need to define a custom class 'mycustomclass' on the button and use the below CSS instead of the one mentioned in article.

 

.mycustomclass ptcs-button {
ptcs-button-icon--dim: 70px !important;
height: 100px !important;
width: 100px !important;
max-height: 100px !important;
max-width: 100px !important;
min-height: 20px !important;
min-width: 20px !important;
background-color: transparent !important;
border: none !important;
padding: 20px !important;
} 

Translate
Nate_14510-MarbleAuthor
10-Marble
Jun 15, 2022 3:53 PM UTC

This solution did work in Thingworx 8.5, but is not functioning fully on Thingworx 9.2.

 

Applying the custom class raw without any other changes results in the button formatting but the icon remains small. The blue border is from the focus style, activated here to show the button size.

NS_YSmartLab_1-1655308100996.png

 

I have attempted this solution with manual changing of the icon size in the Style Properties and the icon still becomes cropped.

NS_YSmartLab_0-1655307944345.png

Translate
1-Visitor
Aug 3, 2022 8:23 AM UTC

Hi, 

Did you find a solution about this?

 

 

Translate