Insert containers laid out as side-by-side columns.

Inserts a number of multi-element containers laid out side-by-side and returns a list of container objects.

To add elements to the returned columns container:

 
 var cols = Jt.columns("my-3-cols", 3).use();
 Jt.yourElement().use(cols.col(1));
 Jt.yourElement().use(cols.col(0));
 Jt.yourElement().use(cols.col(2));
 
 
See examples below.

Method Signatures and Parameters

Jt.columns(int numColumns)

numColumns (int)

The number of columns to create

Chainable builder methods

numColumns(int numColumns)

The number of columns to create. Must be between 2 and 12 inclusive. Each column will have equal width unless custom widths are specified.

widths(List<Double> widths)

A list of relative column widths. The list size must match the number of columns. For example, [0.7, 0.3] creates two columns with 70% and 30% width respectively. If not specified, all columns have equal width.

gap(io.jeamlit.components.layout.ColumnsComponent.Gap gap)

Controls the space between columns. Options are SMALL (1rem gap, default), MEDIUM (2rem gap), LARGE (4rem gap), or NONE (no gap between columns).

verticalAlignment(io.jeamlit.components.layout.ColumnsComponent.VerticalAlignment verticalAlignment)

The vertical alignment of the content inside the columns. Options are TOP (default), CENTER, or BOTTOM.

border(boolean border)

Whether to show a border around the column containers. If this is false (default), no border is shown. If this is true, a border is shown around each column.

key(String key)

A string to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key.

No description

use()

Put the widget in the app, in the MAIN container.

use(JtContainer container)

Put the widget in the app, in the provided container.

Returns after .use()

(Columns)

The current Columns value of the component.

Examples

Basic three-column layout with headers and content

 import tech.catheu.jeamlit.core.Jt;

 public class ColumnsApp {
     public static void main(String[] args) {
         var cols = Jt.columns(3).use();

         Jt.title("A cat").use(cols.col(0));
         Jt.title("A dog").use(cols.col(1));
         Jt.title("An owl").use(cols.col(2));
     }
 }

forum

Still have questions?

Go to our discussions forum for helpful information and advice from Jeamlit experts.