Dynamically Adjust heightType

Hey, I'm trying to dynamically adjust the heightType of a container by pressing a button. From "fixed" to "auto" using event handler I'm trying run script: "{{container1.heightType = 'auto'}}"

Unfortunately, the heightType stays on "fixed"

Hey @Michael_S!

In general, Retool doesn't support the pattern of component.property = something. Instead, Retool uses methods, like component.setValue("world's best boss"). There are a limited number of these setter methods (some components have .setHidden(true), for example, but some don't) so imo, the best way to figure out which setters are accessible by a specific component is to just type the component name followed by a . (e.g. textInput1.) to bring up the autocomplete menu and look for all the options in the Function category.

If you don't see one that would work (for example, I don't think we have any height setter functions like container1.setHeight('auto')), then there's a common workaround we can use if the setting can be dynamic. However, in the case of the container height specifically, it doesn't like there's a way to make it dynamic :pensive: But I'll file a feature request for this now!

It would need to have some open input field like this to be dynamic:


  1. Use Retool's temporary state (docs here) to create a new temporary state. You can set it to have a default value.
  2. Set your target component's value to be
  3. Write a JS query to update state — state1.setValue(new_value_here)
  4. Run this JS query to update state, and therefore, update your target component!

I've also attached the app I tested this in (see the last tab for the .setValue workaround), feel free to play around with it to get your ideal setup + ask me any questions!