Key/value component "buttons" do not resize to their value's text length

  • Goal: Setting a key/value entry format to Button should yield a button that fits the size of the value's text length.

  • Steps: Using key/value component, give it a data source that has a long value against one of the keys in the JSON object.

  • Details: There are no sizing controls for key/value buttons.

  • Screenshots:

  1. Set format to Button
    image

  2. Button is not wide enough for the value/label it contains

Hey @hansontools ,

I noticed the issue and tried to fix it. However, the key-value component doesn't provide a default auto-width option for the button. A possible solution is to inspect the button's class in the browser and apply custom CSS to adjust its width. This may be a bug.

  • Here is a screenshot.

4 Likes

Thanks, but those class names you're using in your CSS selector change and can't be relied upon.

Hello @hansontools ,

This issue will be forgotten after a Retool version upgrade when the CSS class changes automatically. Unfortunately, there is no solution for now, as this appears to be a bug.

4 Likes

Hey @hansontools! Thanks for reaching out.

It does look like the generated buttons all have a maximum width, which causes particularly long string values to get cut off. I'll document this issue internally and provide an update here as soon as I can. :+1:

You do have the ability to adjust the button width via custom CSS, as mentioned above, but your other option for a short-term fix is to introduce white space into each value. The platform will detect the space, wrap the text value, and automatically adjust the height of button.