st.columns
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 containers, you can use "with" notation (preferred) or just call methods directly on the returned object. See examples below.
Columns can only be placed inside other columns up to one level of nesting.
Warning
Columns cannot be placed inside other columns in the sidebar. This is only possible in the main area of the app.
| Function signature[source] | |
|---|---|
st.columns(spec, *, gap="small") | |
| Parameters | |
spec (int or iterable of numbers) | Controls the number and width of columns to insert. Can be one of:
|
gap ("small", "medium", or "large") | The size of the gap between the columns. Defaults to "small". This argument can only be supplied by keyword. |
| Returns | |
(list of containers) | A list of container objects. |
Examples
You can use with notation to insert any element into a column:
PythonOr you can just call methods directly in the returned objects:
Python
Still have questions?
Our forums are full of helpful information and Streamlit experts.
