Embed Apps in NEXT.JS
Native embedding in your NEXT.JS -based Web App
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
yarn:
yarn add lowcoder-sdknpm:
npm install lowcoder-sdkIntegrate a Lowcoder App or Module into your existing app
Publish your app/module in Lowcoder.
Set the app/module's access privilege as public.
Add code in your existing app as below.
Import CSS Styles
import "lowcoder-sdk/dist/style.css";Embed Lowcoder Apps
Create Wrapper Component to Embed Lowcoder Apps
"use client"
import { LowcoderAppView } from "lowcoder-sdk";
function LowcoderAppWrapper(props) {
const { appId } = props;
return (
<section style={{marginTop: '2rem'}}>
<div style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
}}>
<h1>Lowcoder App</h1>
</div>
<LowcoderAppView
appId={appId}
/>
</section>
)
}
export default LowcoderAppWrapper;Dynamically import the LowcoderAppWrapper component in the file where you want to embed the Lowcoder app
Now, we can embed our Lowcoder app by just passing the appId to the imported LowcoderAppWrapper component.
Embed Lowcoder Modules
Create Wrapper Component to Embed Lowcoder Modules
Dynamically import the LowcoderModuleWrapper component in the file where you want to embed the Lowcoder Module
Now, we can embed our Lowcoder module by just passing the appId to the imported LowcoderModuleWrapper component.
Demo
The result of the above code in NEXT.JS App is shown below in the Demo. The List component with Yellow background is the Lowcoder App and the Table component is the Lowcoder Module :
Properties
appId
string
The app's id is required!
--
baseUrl
string
The api base url of the Lowcoder Instance.
https://api-service.lowcoder.cloud
onModuleEventTriggered
(eventName: string) => void
(Only for Modules) Triggered when module's custom event is triggered. Works only when the app is a module.
--
onModuleOutputChange
(output: any) => void
(Only for Modules) Triggered when module's outputs change. Works only when the app is a module.
--
Last updated
Was this helpful?