JS Widget
A JavaScript-based portlet (Widget) using React, Vue, or Angular, bundled with Liferay’s liferay-portal.js toolkit.
- Build dynamic, single-page-app-like portlets.
- Use modern frameworks (React/Vue/Angular) inside Liferay.
Implementation
Section titled “Implementation”Create a JS Widget
Section titled “Create a JS Widget”blade create -t js-widget user-greeter-widgetWrite the React Component
Section titled “Write the React Component”import React from "react";
export default function UserGreeter({ userName }) { return ( <div className="user-greeter"> <h1>Welcome, {userName}!</h1> <button onClick={() => alert("Thanks for visiting!")}>Click Me</button> </div> );}Configure the Portlet
Section titled “Configure the Portlet”{ "systemjs": { "modules": { "user-greeter-widget": "index.js" } }}Use Cases
Section titled “Use Cases”- User Dashboard: Show personalized greetings.
- Interactive Tools: In-portlet forms, calculators, etc.