The Drawer component is a panel that slides out from the edge of the screen. It can be useful when you need users to complete a task or view some details without leaving the current page.
class DrawerState(rx.State):
show_right: bool = False
show_top: bool = False
def top(self):
self.show_top = not (self.show_top)
def right(self):
self.show_right = not (self.show_right)
def drawer_example():
return rc.vstack(
rc.button(
"Show Right Drawer", on_click=DrawerState.right
),
rc.drawer(
rc.drawer_overlay(
rc.drawer_content(
rc.drawer_header("Confirm"),
rc.drawer_body(
"Do you want to confirm example?"
),
rc.drawer_footer(
rc.button(
"Close",
on_click=DrawerState.right,
)
),
bg="rgba(0, 0, 0, 0.3)",
)
),
is_open=DrawerState.show_right,
),
)
Drawer can display from the top, bottom, left, or right. By defualt it displays to the right as seen above
rc.vstack(
rc.button("Show Top Drawer", on_click=DrawerState.top),
rc.drawer(
rc.drawer_overlay(
rc.drawer_content(
rc.drawer_header("Confirm"),
rc.drawer_body(
"Do you want to confirm example?"
),
rc.drawer_footer(
rc.button(
"Close", on_click=DrawerState.top
)
),
)
),
placement="top",
is_open=DrawerState.show_top,
),
)
rc.DrawerOverlay
Drawer overlay.
Props
No component specific props
Event Triggers
See the full list of default event triggersrc.DrawerContent
Drawer content.
Props
No component specific props
Event Triggers
See the full list of default event triggersrc.DrawerHeader
Drawer header.
Props
No component specific props
Event Triggers
See the full list of default event triggersrc.DrawerBody
Drawer body.
Props
No component specific props
Event Triggers
See the full list of default event triggersrc.DrawerFooter
Drawer footer.
Props
No component specific props