Scratch Block UI

I want to implement a function of BlockUI. When its child nodes increase, Block UI will change accordingly. As shown in the figure, when the repeat block has child nodes, it will be elongated.
I don’t know how to implement this feature, can anyone help me
6170198--675227--upload_2020-8-5_13-53-5.png

https://scratch.mit.edu/projects/editor/?tutorial=getStarted

Sorry, I have to first confirm you’re using UI Toolkit (formally UIElements). Are you using “VisualElement”, for example? This forum is for UI Toolkit, the framework, not general UI discussions or discussions around Unity’s other UI frameworks like IMGUI and uGUI (Unity UI).

If you are using UI Toolkit, this kind of expansion of parent size given size of children comes by default. You have to do extra work if you dont want this to happen. Hence my question above. :slight_smile:

Hi uDamian, Thanks for your reply, this is really great. I’m trying to use UI Toolkit to implement this function, but I just started to learn, can you briefly talk about how to do it, or demo for reference. thank you very much.

One suggestion is to use a background image with 9 slices.
Our USS format supports the following properties to achieve:

-unity-slice-left: <integer>;
-unity-slice-top: <integer>;
unity-slice-right: <integer>;
-unity-slice-bottom: <integer>;

The way I would set this up then is a structure like this:

<VisualElement style="/* add background and slicing here */">
   <VisualElement name="repeat">/*Label + counter here*/</VisualElement>
   <VisualElement name="instructionsContainer">
      /* Simply parent instructions underneath here to make the whole layout expand */
   </VisualElement>
</VisualElement>

Great, thank you very much!