Skip to content

Commit 9fe519e

Browse files
Add doc about how to interact with frontend runnables from HTML component (windmill-labs#458)
1 parent c69f15e commit 9fe519e

File tree

1 file changed

+35
-13
lines changed
  • docs/apps/4_app_configuration_settings

1 file changed

+35
-13
lines changed
Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import DocCard from '@site/src/components/DocCard';
32

43
# HTML
@@ -10,18 +9,18 @@ The HTML component allows you to display HTML content.
109
The following section details HTML component's specific settings. For more details on the App Editor, check the [dedicated documentation](../0_app_editor/index.mdx) or the App Editor [Quickstart](../../getting_started/7_apps_quickstart/index.mdx):
1110

1211
<div class="grid grid-cols-2 gap-6 mb-4">
13-
<DocCard
14-
color="orange"
15-
title="App Editor Documentation"
16-
description="The app editor is a low-code builder to create custom User Interfaces with a mix of drag-and-drop and code."
17-
href="/docs/apps/app_editor"
18-
/>
19-
<DocCard
20-
color="orange"
21-
title="Apps Quickstart"
22-
description="Learn how to build your first app in a matter of minutes."
23-
href="/docs/getting_started/apps_quickstart"
24-
/>
12+
<DocCard
13+
color="orange"
14+
title="App Editor Documentation"
15+
description="The app editor is a low-code builder to create custom User Interfaces with a mix of drag-and-drop and code."
16+
href="/docs/apps/app_editor"
17+
/>
18+
<DocCard
19+
color="orange"
20+
title="Apps Quickstart"
21+
description="Learn how to build your first app in a matter of minutes."
22+
href="/docs/getting_started/apps_quickstart"
23+
/>
2524
</div>
2625

2726
## HTML Input
@@ -36,3 +35,26 @@ The following section details HTML component's specific settings. For more detai
3635
| ------- | :-----: | ---------------------------------------- |
3736
| result | string | The HTML. |
3837
| loading | boolean | The loading state of the HTML component. |
38+
39+
## Calling Frontend runnables
40+
41+
You can call frontend runnable from your HTML component. To do so, you can use the following syntax:
42+
43+
```html
44+
<button onclick="window.parent.postMessage('Hello');">Say Hello</button>
45+
```
46+
47+
You can now catch the message in your frontend runnable:
48+
49+
```js
50+
window.addEventListener(
51+
'message',
52+
(event) => {
53+
if (event.data === 'hello') {
54+
alert('hello');
55+
// You also interact with the app state here for example
56+
}
57+
},
58+
false
59+
);
60+
```

0 commit comments

Comments
 (0)