Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Expander

A collapsible section with a clickable header.

with sc.Expander('Configurations', expanded=True):
    sc.Checkbox('Enable caching')
    sc.Button('Force refresh')
ArgumentTypeMeaning
labelstr | PropertyHeader text
expandedboolWhether the body starts open
visiblebool | PropertyWhether the expander is shown

Properties: label, visible.

Expanding and collapsing is handled entirely in the browser, so it never reaches the server and never triggers a rerun.

Dynamic header

label is bindable:

sc.Expander(sc.bind(state.file_count, lambda n: 'Files ({})'.format(n)))

Hiding

visible=False removes the whole expander, header included. To keep the header but hide the body, use a Container with animated=True and drive its visible from a ToggleButton.