
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@lf-widgets/framework
Advanced tools
LF Widgets - Core manager and framework modules, including theming, asset management, and submodule orchestration.
LF Widgets is a lightweight and versatile Web Components library designed to enhance your web development experience.
Built with modern standards and best practices in mind, LF Widgets offers a collection of reusable components that can seamlessly integrate into any web project, regardless of the framework or vanilla JavaScript setup.
If you haven't installed Yarn yet, get it done with:
npm install -g yarn
Or check out Yarn's installation guide for more options.
Clone this repo and install everything in one go:
git clone https://github.com/lucafoscili/lf-widgets.git
cd lf-widgets
yarn install
Fire up the showcase to view the webcomponents:
yarn dev:setup
That's it!
After installing, you can import and use LF Widgets components in your project. Here's a quick example of how to use the <lf-button>
component directly in your HTML file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>LF Widgets Example</title>
<script
type="module"
src="./path/to/@lf-widgets/framework/dist/framework/lf-framework.esm.js"
></script>
<script
type="module"
src="./path/to/@lf-widgets/core/dist/lf-core/lf-core.esm.js"
></script>
</head>
<body>
<lf-button lf-label="Click me!" />
</body>
</html>
Make sure to replace the paths with the actual locations of the LF Widgets packages in your project.
The event handling is wrapped in a single event, emitted by the root element. In this small example we add a listener to the button component, performing different actions for different situations:
const myButton = document.createElement("lf-button");
myButton.addEventListener("lf-button-event", (e) => {
const { eventType } = e.detail;
switch (eventType) {
case "click":
console.log("Click!");
break;
case "blur":
console.log("Blur!");
break;
case "ready":
console.log("The button is ready!");
break;
case "unmount":
console.log("The button has been removed from the DOM!");
break;
}
document.body.appendChild(myButton);
});
LF Widgets ships with a small singleton “core” (LfFramework
) that underpins theming, portals, debugging features, and more. The singleton must be initialized manually. This is an architectural choice to avoid global state and ensure that the core is only created when needed. In addition, by initializing the core early, you can set up theming and other features before components are rendered to avoid flickering.
Below is the recommended pattern, using this function exported by the @lf-widgets/framework
package:
getLfFramework()
// In your top-level code or a dedicated file
import { getLfFramework } from "@lf-widgets/core";
// Elsewhere, in a component or function:
function doSomething() {
const framework = getLfFramework();
framework.assets.set("https://example.com/assets");
framework.theme.set("dark");
// ...
}
Description:
Provides an advanced charting solution built on top of the Echarts library. It supports various chart types, including line, bar, bubble, and candlestick charts, as well as unique options like dual-axis and heatmap calendars.
Features:
Use Case Highlight:
Perfect for building real-time dashboards, financial data visualizations, and multi-dimensional analytics with polished and professional aesthetics.
Description:
Perfect for creating visually appealing layouts with items of varying sizes. It supports a dynamic masonry or waterfall grid style, making it ideal for galleries, portfolios, and content-heavy applications.
Features:
Use Case Highlight:
Display dynamic content, such as photo galleries or portfolio showcases, where items vary in size and need an elegant, responsive layout.
Description:
Provides a customizable chat interface for interactive roleplay or AI-driven conversations. Users can define a JSON dataset of characters and initiate dynamic dialogues through a third-party API (OpenAI compatible endpoint required).
Features:
Use Case Highlight:
Perfect for creating immersive role-playing experiences, educational tools, or conversational agents where users can interact with pre-defined characters.
Note:
A functional local endpoint is required for chat functionality. If the endpoint is offline, the chat interface will remain static.
If you discover a new bug or have an exciting idea for a new component, feel free to open an issue or a discussion! Check out the issues or discussions tabs to see how you can get involved.
Pull requests are also welcome if you want to contribute firsthand. Just clone the repository and run from the root:
yarn install
Then build the library with the command:
yarn build
Finally, you can launch the development environment with the command:
yarn dev
The project uses Sass Modules only. Legacy @import
is forbidden (enforced by yarn lint:scss-modules
).
Guidelines:
@use
for consuming, @forward
for re‑exporting.@use
statements at the very top of the file.@use "..." as *
when bringing in multiple partials that expose the same configurable variables (e.g. $comp
). Provide short, unique namespaces instead.with (...)
must be declared with !default
in the partial (example: $comp: null !default;
).@forward
statements—no styles, no mixin calls.Run the validation locally:
yarn lint:scss-modules
If it fails, replace remaining @import
with proper @use
/ @forward
equivalents.
Comfy
MarriageLF Widgets forms the backbone of LF Nodes for ComfyUI, a suite of custom nodes designed for ComfyUI workflows. This integration showcases the power and flexibility of web components, making it clear just how effortless it is to introduce new widgets into complex systems.
Why it works:
And… they look fantastic in action!
For detailed information about LF Widgets, including architecture, framework, and individual components, please refer to the following documentation:
For detailed information about each component, including available properties, events, and methods, please refer to the showcase.
Tool | Purpose | License |
---|---|---|
Cypress | E2E tests engine | MIT |
Echarts | Data visualization components | Apache 2.0 |
Google Fonts | Typography for various components | OFL |
Next.js | Engine behind the showcase application | MIT |
Prism.js | Syntax highlighting for code blocks | MIT |
Stencil.js | Web Components engine | MIT |
Tabler Icons | Icon library for UI elements | MIT |
Vite | Development server for the showcase | MIT |
For detailed licensing information, see the NOTICE file.
LF Widgets originates from a fork of Ketchup. While Ketchup provided a strong foundation, LF Widgets has been completely reimagined with a focus on:
This project uses Tabler Icons under the MIT License. Icons have been customized for this project.
To add custom SVGs:
width
, height
and hardwired colors).src/assets/svg
folder.This project uses several fonts from Google Fonts, including:
To add custom fonts:
src/assets/fonts
folder.FAQs
LF Widgets - Core manager and framework modules, including theming, asset management, and submodule orchestration.
The npm package @lf-widgets/framework receives a total of 144 weekly downloads. As such, @lf-widgets/framework popularity was classified as not popular.
We found that @lf-widgets/framework demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.