Skip to content

SlideContainer reference

Bases: Container

See init for usage and information.

state = reactive[bool](True) class-attribute instance-attribute

State of the container.
True = container open, False = container closed.
You can set this directly, or you can use the toggle() method.

InitCompleted

Bases: Message

Message sent when the container is ready. This is only sent if the container is starting closed.

container = container instance-attribute

The container that is ready.

control property

The SlideContainer that sent the message.

SlideCompleted

Bases: Message

Message sent when the container is opened or closed. This is sent after the animation is complete.

container = container instance-attribute

The container that has finished sliding.

control property

The SlideContainer that sent the message.

state = state instance-attribute

The state of the container.
True = container open, False = container closed.

__init__(*children, slide_direction, dock_position='none', floating=True, start_open=True, fade=False, offset_x=0, offset_y=0, duration=0.8, easing_function='out_cubic', name=None, id=None, classes=None, disabled=False)

Construct a Sliding Container widget.

Parameters:

Name Type Description Default
*children Widget

Child widgets.

()
slide_direction SLIDE_DIRECTION

Can be: - left - right - up - down NOTE: This is not tied to dock position. Feel free to experiment.

required
dock_position DOCK_POSITION

The position to dock the container. Can be: - topleft - top - topright - left - right - bottomleft - bottom - bottomright - none NOTE: When floating is True, this is automatically set to the same direction as the slide direction. (up = top, down = bottom, left = left, right = right) Floating SlideContainers MUST be docked to a direction. However, you can change the dock direction. The dock direction does not need to be the same as the slide direction.

'none'
floating bool

Whether the container should float overtop on its own layer.

True
start_open bool

Whether the container should start open(visible) or closed(hidden).

True
fade bool

Whether to also fade the container when it slides.

False
offset_x int

The

0
offset_y int

The

0
duration float

The duration of the slide animation in seconds.

0.8
easing_function EASING_FUNC

The easing function to use for the animation.

'out_cubic'
name str | None

The name of the widget.

None
id str | None

The ID of the widget in the DOM.

None
classes str | None

The CSS classes for the widget.

None
disabled bool

Whether the widget is disabled or not.

False

close()

Close the container. This is the same as setting state to False.

open()

Open the container. This is the same as setting state to True.

set_slide_direction(direction)

Set the slide direction of the container.

Parameters:

Name Type Description Default
direction str

The new slide direction. Must be one of 'left', 'right', 'up', or 'down'.

required

toggle()

Toggle the state of the container. Opens or closes the container.