Skip to content

Commit 4ba1a8b

Browse files
Openblocks-docsgitbook-bot
Openblocks-docs
authored andcommitted
GitBook: [lowcoder-org#100] No subject
1 parent 0ffa425 commit 4ba1a8b

File tree

8 files changed

+56
-0
lines changed

8 files changed

+56
-0
lines changed

docs/.gitbook/assets/close-drawer.PNG

244 KB
Loading
125 KB
Loading
21.6 KB
Loading
34.5 KB
Loading
1.96 MB
Loading

docs/.gitbook/assets/open-drawer.PNG

95.2 KB
Loading

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* [Component guides](build-apps/component-guides/README.md)
3434
* [Option lists](build-apps/component-guides/option-lists.md)
3535
* [List View](build-apps/component-guides/list-view.md)
36+
* [Drawer](build-apps/component-guides/drawer.md)
3637
* [Image](build-apps/component-guides/image.md)
3738
* [Use Markdown](build-apps/component-guides/use-markdown.md)
3839
* [Module](build-apps/module.md)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Drawer
2+
3+
In Openblocks, **Drawer** is an overlay sidebar to display information or perform operations, without interrupting the workflow on the main window.
4+
5+
The following example builds a shopping cart using a drawer.
6+
7+
<figure><img src="../../.gitbook/assets/drawer-shopping-app.gif" alt=""><figcaption></figcaption></figure>
8+
9+
## Layout
10+
11+
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.
12+
13+
<figure><img src="../../.gitbook/assets/drawer-layout.PNG" alt=""><figcaption></figcaption></figure>
14+
15+
{% hint style="info" %}
16+
When a drawer is closed, you can re-open it by clicking the corresponding label in the **Modals** tab in the left pane.
17+
{% endhint %}
18+
19+
### Position
20+
21+
In the **Properties** tab, you can set the position of the drawer. The default position is the right side of the main window.
22+
23+
<figure><img src="../../.gitbook/assets/drawer-position.png" alt=""><figcaption></figcaption></figure>
24+
25+
### Resize
26+
27+
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.
28+
29+
<figure><img src="../../.gitbook/assets/drawer-resize.png" alt=""><figcaption></figcaption></figure>
30+
31+
## Events
32+
33+
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**.
34+
35+
The following sections guide you through how to open and close a drawer by clicking a button in an online shopping app.
36+
37+
### Trigger openDrawer
38+
39+
Usually, in an app, you trigger opening a drawer by an event such as clicking a button. For example, in the [Online Shopping demo](https://cloud.openblocks.dev/apps/63a422a344075b798fe3ae06/view), opening a drawer to display the shopping cart is implemented in the following steps.
40+
41+
1. Add a button and rename it as `gotoCart`.
42+
2. 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.&#x20;
43+
44+
<figure><img src="../../.gitbook/assets/open-drawer.PNG" alt=""><figcaption></figcaption></figure>
45+
3. Click the button `gotoCart` and the binded drawer "cart" is open.
46+
47+
### Trigger closeDrawer
48+
49+
Triggerring "closeDrawer" is similar to triggering "openDrawer". When setting up the event handler, select the method "closeDrawer". For example, in the [Online Shopping demo](https://cloud.openblocks.dev/apps/63a422a344075b798fe3ae06/view), closing a drawer that displays the shopping cart is implemented in the following steps.
50+
51+
1. Add a button and rename it as `gobackShopping`.
52+
2. 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.&#x20;
53+
54+
<figure><img src="../../.gitbook/assets/close-drawer.PNG" alt=""><figcaption></figcaption></figure>
55+
3. Click the "Continue Shopping" button and the binded drawer "cart" is closed.

0 commit comments

Comments
 (0)