Containers: hbox, vbox & canvas
Why hbox and vbox auto-compute their dimensions from their children, why manual resizing behaves differently, and when to use canvas.
On this page
Why you cannot freely resize an hbox or vbox (or drag children inside them)
One of the most common surprises when building GRUB 2 themes in Grub Designer is placing components inside an hbox or vbox and noticing:
- The
hbox/vboxcontainer itself has no manualW/Hinputs or resize handles. - Direct child components inside an
hbox/vboxcannot be dragged to arbitrary(left, top)positions.
This is not a limitation of the editor — it is the exact layout algorithm implemented in GNU GRUB 2's C source (grub-core/gfxmenu/gui_box.c). Try the interactive simulator below to see how hbox, vbox, and canvas behave when children change size:
hbox stacks children left-to-right and automatically computes its own width (sum of children) and height (tallest child). Manual W/H handles on the container and left/top offsets on children do not exist in GRUB 2.
How hbox works (Horizontal Box)
hbox arranges its visible children left-to-right in a single horizontal row:
- Container width: Automatic sum of every child's width.
- Container height: Automatic height of the tallest child.
- Child
leftandtop: Ignored by GRUB 2 and omitted fromtheme.txt. Children are positioned strictly in layer order. - Changing the size of an
hbox: Select a child directly (usingCtrl + Clickon the canvas or selecting it in the Layers tree) and resize the child'swidthorheight(for resizable widgets likeimageorprogress_bar), or adjust its font/text (for auto-sized widgets likelabel). The parenthboximmediately expands or shrinks to fit.
How vbox works (Vertical Box)
vbox arranges its visible children top-to-bottom in a single vertical column:
- Container width: Automatic width of the widest child.
- Container height: Automatic sum of every child's height.
- Child
leftandtop: Ignored by GRUB 2 and omitted fromtheme.txt.
How canvas works (Free Positioning Container)
If you want a grouped container with explicit width and height where every child can be dragged and resized freely to exact (left, top) coordinates, use canvas instead of hbox/vbox:
| Behavior | hbox |
vbox |
canvas |
|---|---|---|---|
Explicit width & height |
No (auto-computed) | No (auto-computed) | Yes (8-handle resize) |
Child left & top offsets |
Ignored | Ignored | Yes (relative to canvas) |
| Overlapping children | No (sequential row) | No (sequential column) | Yes (layer z-order) |
| Ideal use case | Footer keycap rows, icon + countdown pairs | Stacked status lines | Modal cards, complex HUD groups |
Working smoothly with containers in Grub Designer
- Single Click on any child inside a container selects the root container so you can reposition the whole group cleanly on the viewport.
Ctrl + Click(or clicking the child in the Layers (L) panel) selects the individual child directly so you can edit its properties, reorder it, or resize it if its widget type supports manual bounds.- Need spacing between items inside an
hboxorvbox? Add padding inside your child artwork or insert a lightweight transparentimagespacer with the exact pixel width or height you want.