Layouts

gui.div, gui.tag, gui.columns, gui.center, gui.expander, sidebar_layout

gui.columns — Equal columns

Column 1
Column 2

gui.columns — Weighted columns

1/4
3/4

gui.center

Centered content

Both horizontally and vertically

gui.expander

gui.div & gui.tag

gui.tag('span')any HTML tageven inline elements

sidebar_layout — Collapsible sidebar

This page itself uses sidebar_layout for the left navigation panel.


Pattern used on this page:

from widgets.sidebar import sidebar_layout

# In your route handler:
sidebar, page_content = sidebar_layout(
    key="my-sidebar",
    session=request.session,
)

with sidebar:
    # Sidebar content — nav links, filters, etc.
    gui.write("**Navigation**")
    for section in sections:
        with gui.tag("a", href=f"#section-{section.id}"):
            gui.html(section.label)

with page_content:
    # Main page content
    render_page()

Open / close via JavaScript events:

// Open the sidebar
window.dispatchEvent(new Event('my-sidebar:open'))

// Close the sidebar
window.dispatchEvent(new Event('my-sidebar:close'))

Try it:

Content & Text

gui.write, gui.markdown, gui.text, gui.html, gui.caption, gui.error, gui.success

gui.write — Primary output (supports Markdown)

Bold, italic, and inline code

With help tooltip

gui.html — Raw HTML

Raw HTML with inline styles

gui.error & gui.success

āœ…

Operation completed successfully!

šŸ”„

Something went wrong, please try again.

gui.markdown — Explicit Markdown block

Markdown heading

  • List item one
  • List item two

> Blockquote text

gui.text — Preformatted text

This is preformatted text.
  Indentation is preserved.
    Like a <pre> block.

gui.caption & gui.newline

Regular text above

This is a caption — small and muted


After a gui.newline() break

Headings via gui.write

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Icons

Font Awesome 6 — use tags with gui.html()

How to render icons

Common icon styles



Icons in buttons

Open link

Navigation

gui.tabs, gui.controllable_tabs, gui.nav_tabs, gui.breadcrumbs

gui.tabs — Rounded tabs

Overview content here

Details content here

Settings content here

gui.breadcrumbs

gui.nav_tabs — Underline tabs

Content for the active tab

gui.controllable_tabs

Selected tab index: 0

Text Inputs

gui.text_input, gui.text_area, gui.password_input, gui.code_editor

gui.text_input

gui.text_area

gui.password_input

gui.code_editor

Loading...

Numeric & Date Inputs

gui.number_input, gui.slider, gui.date_input

gui.number_input

gui.slider

gui.date_input

Selection Inputs

gui.checkbox, gui.switch, gui.radio, gui.horizontal_radio, gui.selectbox, gui.multiselect

gui.checkbox

gui.radio

Choose a model

gui.selectbox

gui.switch

gui.horizontal_radio

Output format

gui.multiselect

File Upload

gui.file_uploader

gui.file_uploader

Loading...

Buttons & Links

gui.button, gui.anchor, gui.url_button, gui.download_button

gui.button — All types

gui.anchor — Styled link

Visit Gooey.AI

gui.url_button

gui.download_button

gui.download_button(label, url) — renders a download link styled as a button.

Media

gui.image, gui.video, gui.audio

gui.image

Random image via picsum.photos

Random image via picsum.photos

gui.video

šŸŽ„ Random video via YouTube

gui.audio

šŸŽ§ Random audio

Download

Overlays & Feedback

gui.tooltip, gui.popover, gui.pill, gui.modal_scaffold, gui.alert_dialog, gui.confirm_dialog

gui.tooltip

gui.popover

gui.pill

DefaultPrimarySecondaryDark

gui.alert_dialog

gui.button_with_confirm_dialog

Data Display

gui.table, gui.data_table, gui.json, gui.plotly_chart

gui.json — Interactive JSON viewer

{4 Items
"name"
:
string
"Gooey.AI"
"components"
:
int
45
"features"
:
[3 Items
0
:
string
"server-driven UI"
1
:
string
"Bootstrap 5"
2
:
string
"realtime updates"
]
"nested"
:
{2 Items
"key"
:
string
"value"
"list"
:
[3 Items
0
:
int
1
1
:
int
2
2
:
int
3
]
}
}

gui.data_table

Loading...

gui.plotly_chart

gui.plotly_chart(figure_or_data) — pass a Plotly figure object or dict.

Requires plotly to be installed.

Styling & Scripting

gui.styled, gui.js, and Bootstrap 5 className

gui.styled — Scoped CSS with & selector

This container has scoped gradient styles via gui.styled()

Bootstrap 5 className

bg-dark + text-white + rounded
border-primary
bg-light + shadow-sm + fw-bold

gui.js — Inject JavaScript

gui.js(src, **kwargs) injects a &lt;script&gt; tag. Used internally to load GooeyEmbed and other JS widgets.

State Management

gui.session_state

gui.session_state — Per-user state dict

All input components automatically read from and write to gui.session_state.

# Read a value
name = gui.session_state.get(&#x27;user_name&#x27;, &#x27;default&#x27;)

# Write a value
gui.session_state[&#x27;user_name&#x27;] = &#x27;Alice&#x27;

# Use with inputs — the key links the widget to state
gui.text_input(&#x27;Name&#x27;, key=&#x27;user_name&#x27;)