✨ Announcing our seed funding led by Lux Capital! Read more about it on our blog
DocsBlogChangelog

Search documentation...

/

Star

12k+

[ Learn ]

[ Concepts ]

[ Reference ]

Drawer


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.

For purpose of these example we will be using this same state.

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)


rx.box(
    rx.button(
        "Show Right Drawer", on_click=DrawerState.right
    ),
    rx.drawer(
        rx.drawer_overlay(
            rx.drawer_content(
                rx.drawer_header("Confirm"),
                rx.drawer_body(
                    "Do you want to confirm example?"
                ),
                rx.drawer_footer(
                    rx.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.
rx.box(
    rx.button("Show Top Drawer", on_click=DrawerState.top),
    rx.drawer(
        rx.drawer_overlay(
            rx.drawer_content(
                rx.drawer_header("Confirm"),
                rx.drawer_body(
                    "Do you want to confirm example?"
                ),
                rx.drawer_footer(
                    rx.button(
                        "Close", on_click=DrawerState.top
                    )
                ),
            )
        ),
        placement="top",
        is_open=DrawerState.show_top,
    ),
)

Drawer


A drawer component.


DrawerBody


Drawer body.


  • No props for DrawerBody.

  • Base Event Triggers

DrawerHeader


Drawer header.


  • No props for DrawerHeader.

  • Base Event Triggers

DrawerFooter


Drawer footer.


  • No props for DrawerFooter.

  • Base Event Triggers

DrawerContent


Drawer content.


  • No props for DrawerContent.

  • Base Event Triggers

DrawerOverlay


Drawer overlay.


  • No props for DrawerOverlay.

  • Base Event Triggers

← AlertDialogMenu →

Copyright © 2023 Pynecone, Inc.