Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d85ceff

Browse files
adnanqaopsgitbook-bot
authored andcommitted
GITBOOK-173: Added the page "Embed Apps in NEXT.JS"
1 parent 9d76939 commit d85ceff

File tree

3 files changed

+157
-0
lines changed

3 files changed

+157
-0
lines changed

‎docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
* [Embedd an App](publish-apps/embedd-an-app/README.md)
120120
* [Embed App in HTML Pages](publish-apps/embedd-an-app/embed-app-in-html-pages.md)
121121
* [Embed Apps in React](publish-apps/embedd-an-app/embed-apps-in-react.md)
122+
* [Embed Apps in NEXT.JS](publish-apps/embedd-an-app/embed-apps-in-next.js.md)
122123
* [Native embed SDK](publish-apps/embedd-an-app/native-embed-sdk/README.md)
123124
* [Build the SDK from Source](publish-apps/embedd-an-app/native-embed-sdk/build-the-sdk-from-source.md)
124125

‎docs/connect-your-data/data-sources-in-lowcoder/apis-as-datasource/rest-api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ Follow the steps to create a REST API query directly.
5656
2. Select **REST Query** in Data Sources. Lowcoder offers this built-in plain data source so that you can quickly create REST API queries without adding a new data source first.
5757
3. Enter URL, Query, Variables, Parameters, and fill in other fields if needed.
5858
4. Click â–¶ **Run**.
59+
60+
### Demo 
61+
62+
{% embed url="https://demos.lowcoder.cloud/demo/clxsvibl3017u12o272ew9p67" %}
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Embed Apps in NEXT.JS
2+
3+
### Native embedding in your NEXT.JS -based Web App
4+
5+
First, install the Lowcoder SDK. Lowcoder publishes with every Version Release, a new version of Lowcoder SDK too. [https://www.npmjs.com/package/lowcoder-sdk](https://www.npmjs.com/package/lowcoder-sdk)
6+
7+
yarn:
8+
9+
```
10+
yarn add lowcoder-sdk
11+
```
12+
13+
npm:
14+
15+
```
16+
npm install lowcoder-sdk
17+
```
18+
19+
### Integrate a Lowcoder App or Module into your existing app
20+
21+
1. Publish your app/module in Lowcoder.
22+
2. Set the app/module's access privilege as public.
23+
3. Add code in your existing app as below.
24+
25+
### Import CSS Styles
26+
27+
```
28+
import "lowcoder-sdk/dist/style.css";
29+
```
30+
31+
### Embed Lowcoder Apps
32+
33+
* Create Wrapper Component to Embed Lowcoder Apps
34+
35+
````
36+
```
37+
"use client"
38+
import { LowcoderAppView } from "lowcoder-sdk";
39+
40+
function LowcoderAppWrapper(props) {
41+
const { appId } = props;
42+
return (
43+
<section style={{marginTop: '2rem'}}>
44+
<div style={{
45+
display: 'flex',
46+
justifyContent: 'space-between',
47+
alignItems: 'center',
48+
}}>
49+
<h1>Lowcoder App</h1>
50+
</div>
51+
<LowcoderAppView
52+
appId={appId}
53+
/>
54+
</section>
55+
)
56+
}
57+
58+
export default LowcoderAppWrapper;
59+
```
60+
````
61+
62+
* Dynamically import the LowcoderAppWrapper component in the file where you want to embed the Lowcoder app
63+
64+
````
65+
```
66+
const LowcoderAppWrapper = dynamic(
67+
() => import('../components/LowcoderAppWrapper'), {ssr: false}
68+
);
69+
```
70+
````
71+
72+
* Now, we can embed our Lowcoder app by just passing the appId to the imported LowcoderAppWrapper component.
73+
74+
````
75+
```
76+
<LowcoderAppWrapper
77+
appId='66ab6af10390b00771b2e649'
78+
/>
79+
```
80+
````
81+
82+
### Embed Lowcoder Modules
83+
84+
* Create Wrapper Component to Embed Lowcoder Modules
85+
86+
````
87+
```
88+
"use client"
89+
import { useRef } from "react";
90+
import { LowcoderAppView } from "lowcoder-sdk";
91+
92+
function LowcoderModuleWrapper(props) {
93+
const { appId } = props;
94+
const appRef = useRef();
95+
return (
96+
<section style={{marginTop: '2rem'}}>
97+
<div style={{
98+
display: 'flex',
99+
justifyContent: 'space-between',
100+
alignItems: 'center',
101+
}}>
102+
<h1>Lowcoder Module</h1>
103+
<button
104+
type="button"
105+
onClick={() => {
106+
appRef?.current?.invokeMethod("ShowNotification")
107+
}}
108+
>
109+
Invoke module method
110+
</button>
111+
</div>
112+
<LowcoderAppView
113+
ref={appRef}
114+
appId={appId}
115+
116+
/>
117+
</section>
118+
)
119+
}
120+
121+
export default LowcoderModuleWrapper;
122+
```
123+
````
124+
125+
* Dynamically import the LowcoderModuleWrapper component in the file where you want to embed the Lowcoder Module
126+
127+
````
128+
```
129+
const LowcoderModuleWrapper = dynamic(
130+
() => import('../components/LowcoderModuleWrapper'), {ssr: false}
131+
);
132+
```
133+
````
134+
135+
* Now, we can embed our Lowcoder module by just passing the appId to the imported LowcoderModuleWrapper component.
136+
137+
````
138+
```
139+
<LowcoderModuleWrapper
140+
appId="660f13367c18a91b174fe96d"
141+
/>
142+
```
143+
````
144+
145+
### Properties
146+
147+
| Name | Type | Description | Default value |
148+
| ---------------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------- |
149+
| appId | string | The app's id is required! | -- |
150+
| baseUrl | string | The api base url of the Lowcoder Instance. | https://api-service.lowcoder.cloud |
151+
| onModuleEventTriggered | (eventName: string) => void | (Only for Modules) Triggered when module's custom event is triggered. Works only when the app is a module. | -- |
152+
| onModuleOutputChange | (output: any) => void | (Only for Modules) Triggered when module's outputs change. Works only when the app is a module. | -- |

0 commit comments

Comments
 (0)