Drawer
In Lowcoder, Drawer is an overlay sidebar to display information or perform operations, without interrupting the workflow on the main window.
The following example builds a shopping cart using a drawer.
Layout
When inserted by drag-and-drop operation, a Drawer floats on the right side (by default) of the main window. Then, you can add components onto the Drawer according to your needs. In the editing mode of a Drawer, other components on the canvas are not editable.
Position
In the Properties tab, you can set the position of the drawer. The default position is the right side of the main window.
Resize
In Properties tab, you can set the width of the drawer by pixels or percentage. Note that the height of a drawer is the same as the main window and is not customizable.
Events
You can reference a drawer in JS code anywhere in your app or call it through a "control component" action in Properties > Interaction > Event handlers.
The following sections guide you through how to open and close a drawer by clicking a button in an online shopping app.
Trigger openDrawer
Add a button and rename it as
gotoCart
.Set the event handler of the button. Select "Control component" as the Action and select the component "cart" and method "openDrawer". All these settings are auto-saved.
Click the button
gotoCart
and the binded drawer "cart" is open.
Trigger closeDrawer
Add a button and rename it as
gobackShopping
.Set the event handler of the button. Select "Control component" as the Action and select the component "cart" and method "closeDrawer". All these settings are auto-saved.
Click the "Continue Shopping" button and the binded drawer "cart" is closed.
Component Playground
On Component Playground, you can interact with the Drawer component and explore it's Properties, Events and Methods. Play with different Styling properties to see the effect on the Drawer component.
Component Auto-Docs
In the Auto-Docs of Drawer component, we have shown how to use different properties of the Drawer component. It also includes the Styling properties of the Drawer component.
Properties of the Drawer component
visibile
Returns True or False based on whether the Drawer component is visible or not
Methods
You have the capability to engage with components via their respective methods, which can be accessed by their designated names within any segment where JavaScript is utilized. Additionally, these components can be activated through the 'Control Component' action, which is triggered in response to specific events.
openDrawer
Opens a Drawer component
closeDrawer
Closes a Drawer component
setVisible
Sets the value of property Visible
resetVisible
Resets the value of property Visible
clearVisible
Clears the value of propery Visible
Last updated
Was this helpful?