Custom Button Auto-Width

Is it possible to create a custom button (shape + text layer as a group) and make that button as a whole Auto-Width?

Use Case - I want a button text to shrink/expand with the length of cell’s value.

Similar idea is using a Chip List - but can’t figure out how to only display 1 result instead of all the rows of the list.

Yes its possible, but shrinking I am not sure.

I don’t think it works with a button, which is a same. Tried creating the component and whichever way I sliced it, it did not expand or shrink together. The text component set to Auto-width will work, but not the component as a whole.

You can use a workaround here.

Name the property with character length as low as possible.

For example, i will name the property of any collection as ‘a’.

Now when I use magic text in the custom button, the text will be displayed as ‘a’ on the button.

Size the button according to the single letter ‘a’.

Now if the property ‘a’ for a record is equal to ‘sample button’, the length of the custom button will change automatically

1 Like

@prakharm8 Just to understand you better,

Make a collection. For the column header, put “a”.
In the cell value of row 1 under “a”, I can put longer cell value. I.e. New York

Create a rectangle, create a text component, and group them as a button.

Assign the text label as magic label to row 1 column “a”, which is a property.

Did I understand you correctly? If so, I’m unsure if this will work. The label may be set to auto width but the background rectangle won’t expand???

@prakharm8 I just tested the following - >

  1. Created a single-line text property, called it “a”
  2. Made a magic text label and assigned it to “a”
  3. Put the label on top of a rectangle and made the rectangle very small height and width to test if it’ll auto-expand
  4. Grouped the Text Label and Rectangle

Preview = Button label expands with Cell’s Value. The background button does not expand. The text bleeds outside of the button background.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.