Tickit::Widget::HBox - distribute child widgets in a horizontal row


   use Tickit;
   use Tickit::Widget::HBox;
   use Tickit::Widget::Static;

   my $hbox = Tickit::Widget::HBox->new;

   foreach my $position (qw( left centre right )) {
            text   => $position,
            align  => $position,
            valign => "middle",
         expand => 1

   Tickit->new( root => $hbox )->run;


This subclass of Tickit::Widget::LinearBox distributes its children in a horizontal row. Its height will be the height of the tallest child, and its width will be the sum of the widths of all the children, plus the inter-child spacing.

Optionally, if given a non-zero spacing between child widgets and a style to draw in, a vertical dividing line will be drawn between each child.


The default style pen is used as the widget pen. The following style pen prefixes are also used:

line => PEN

Since version 0.52.

The pen used to render a dividing line between child widgets.

Note that while the widget pen is mutable and changes to it will result in immediate redrawing, any changes made will be lost if the widget style is changed.

The following style keys are used:

spacing => INT

The number of columns of spacing between children

line_style => INT

Since version 0.52.

If set, the style to draw a dividing line between each child widget. Must be one of the LINE_* constants from Tickit::RenderBuffer.


Paul Evans <>