Layui: a browser-native UI component library that ships as plain HTML, CSS and JavaScript
A web UI component library following native browser development patterns.
At a glance
- What is it?
- Layui is an MIT-licensed component library built around the original browser development model rather than a build pipeline. It fits server-rendered admin pages and teams without a frontend toolchain, and it is the wrong choice when you want a component model with typed props and a bundler-first workflow.
- Who is it for?
- Adopt Layui if you maintain server-rendered pages, internal admin tools, or template-driven backends and want components that work by loading CSS and JavaScript directly in the browser, without a build step or a framework runtime. Do not adopt it if your project already depends on a component model with typed props, compiled templates, and tree-shaken bundles, because Layui's value proposition is precisely the absence of that layer.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 2 days ago.
- What is it written in?
- Mainly JavaScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 12, 2026, and from our analysis. They are not legal advice.
Star history
- layui/layui30,584 ★ · +12
| Repository | 2026-09-13 | 2026-11-12 |
|---|---|---|
| layui/layui | 30.6k | 30.6k |
12 Stars in the last 60 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The gap Layui fills: components without a build pipeline
The README describes Layui as a Web UI component library that follows a pure native HTML, CSS and JavaScript development model, and states that it lowers the barrier for non-frontend developers building complex page interfaces. That sentence is the whole positioning. The target user is not a frontend specialist choosing between component libraries. It is a backend developer, a template author, or a small team shipping an admin console, a CMS backend, or an internal tool where the page is rendered by the server and the interactive parts are a form, a table, a modal, and a date picker.
In that setting, the cost of a modern frontend stack is not the framework itself. It is the toolchain: a package manager, a bundler, a transpiler, a dev server, and the build configuration that has to be maintained by someone who understands it. Layui's claim is that you can skip all of that. You include the stylesheet and the script, you write HTML with the expected class names and attributes. The README frames this as letting developers face the browser directly. Whether that is a virtue or a constraint depends entirely on who is maintaining the page six months later.
How the mechanism works: markup first, JavaScript second
The README does not describe Layui's internals. What it states is that Layui follows a pure native HTML, CSS and JavaScript development model, so a developer only needs to face the browser for the elements and interactions a page needs. The repository builds its CSS with PostCSS and its JavaScript with Rollup into dist/, and the npm package ships only dist, so the build step belongs to the maintainers rather than to people using the library.
Getting it running from the documented entry points
The README gives two documentation entry points: Layui 3, which it marks as under development and links to a GitHub issue rather than a release, and Layui 2, linked at layui.dev/docs/2. The current stable line is 2.x, with v2.13.9 published on 2026-08-11, following v2.13.8 on 2026-06-30 and v2.13.7 on 2026-05-29. If you are evaluating the project today, the 2.x documentation is the one that describes shipped behavior.
The README itself does not include an installation command or a configuration snippet, so the exact setup steps have to come from the documentation site rather than this page. The repository's package.json names the package layui and its files field ships only the dist directory, which holds the built assets.
Confirm in the Layui 2 documentation at layui.dev/docs/2/ how the library is loaded in your deployment before starting, since the README gives no setup details.
Where the browser-native model breaks down
The same design that makes Layui easy to adopt makes it awkward in codebases that have moved past direct DOM manipulation. If your application state lives in a store and your views are derived from it, Layui components sit outside that system. You will end up writing imperative glue: after the store updates, find the element, call the component's render or reload method, and hope the two stay in sync. That glue is where bugs accumulate, and no amount of documentation removes it.
There is a second limitation in the release history. Between May and August 2026 the project shipped three patch releases, v2.13.7, v2.13.8 and v2.13.9. Patch releases are normal for a maintained library, but they mean that if you vendor the built files into your repository, you own a recurring update task. Pinning to a CDN URL moves that task to the CDN but does not remove the need to check what changed.
The third issue is the version split. The README states that Layui 3 is in development and links to an issue for it. Starting a new project on the 2.x line means accepting that the next major version exists on a roadmap you cannot fully evaluate from the README. The README also records that the project recommended users move to mainstream frameworks in a 2021 announcement and continues to describe itself as filling the narrower gaps outside the mainstream. Read that as an honest statement of scope, not as a warning, but do read it.
Layui against a framework component library
The natural comparison is a component library that ships inside a framework runtime, where components are declared in the framework's template syntax and receive props and state through the framework's own mechanism. The difference is not cosmetic. In that model, a table component re-renders when its data prop changes, and the framework reconciles the DOM for you. Layui instead works directly against the browser DOM. The first approach scales better as the number of interacting components grows. The second approach requires no runtime, no compilation, and no understanding of a component lifecycle beyond when to call the update function.
For a page with four interactive elements, the second approach is simpler and the difference is small. For a single-page application with dozens of interdependent views, the first approach wins, and choosing Layui means writing the coordination layer yourself. That is the trade in one sentence: Layui removes the toolchain and hands you the DOM.
Licence and maintenance expectations
Layui is released under the MIT licence, which permits use, modification, and redistribution with the licence notice preserved, and the README points to a separate disclaimer document hosted on Gitee for related terms. This article is not legal advice; if your organisation has restrictions on third-party code, the disclaimer is the document to read, not the licence badge.
Maintenance cost depends on how you consume the library. The npm package and the CDN both give you a versioned artifact, so the upgrade decision is yours to schedule. The repository shows continuous activity, with the most recent push on 2026-09-01 and the v2.13.x series arriving on a roughly monthly cadence through mid-2026. That cadence is the practical number to plan against: if you vendor the files, budget a review per patch release, and if you reference a CDN, pin the version in the URL so a patch cannot change your page without a commit.
Editorial conclusion
Adopt Layui if you maintain server-rendered pages, internal admin tools, or template-driven backends and want components that work by loading CSS and JavaScript directly in the browser, without a build step or a framework runtime. Do not adopt it if your project already depends on a component model with typed props, compiled templates, and tree-shaken bundles, because Layui's value proposition is precisely the absence of that layer. Before committing, verify three things against the v2.13.x documentation: how the library is loaded in your deployment, which of the 2.x components you actually need, since Layui 3 is in development and the README links its tracking issue rather than a stable release, and whether your team accepts the upgrade cadence implied by three patch releases between May and August 2026.
Frequently asked questions
What is Layui and who is it for?
It is an open source Web UI component library built with a purely native HTML, CSS and JavaScript development model, intended to make building modern web interfaces more convenient. The project states that it greatly lowers the barrier for non front-end developers, because a developer only needs to face the browser for the elements and interactions a page needs.
How do I install Layui?
The library is published to the npm registry as layui, and the published tarball contains only the dist directory. The main entry is dist/layui.js, and the exports map provides a separate file for ES module imports and for CommonJS requires, plus subpath exports for utilities and for the stylesheet. The project's own README does not include an installation command.
Is Layui still being updated?
Yes. The repository is not archived and the last push was on 2026-09-01, with releases 2.13.7, 2.13.8 and 2.13.9 landing in May, June and August 2026. A 2021 announcement about the original official site going offline led many people to believe development had stopped, and the project's own documentation addresses that directly.
What is the difference between Layui 2 and Layui 3?
Layui 2 is the current documented and published line, running to release 2.13.9. Layui 3 is under development and tracked in a separate issue, and the repository's package.json already reads 3.0.0-alpha.3. So the package.json in the repository describes the 3.0 alpha, while the latest GitHub release is 2.13.9.
What licence is Layui released under?
MIT. The project also points to a separate disclaimer document in the repository for other related terms, alongside the licence file, so the MIT grant is not the only document to read before using it.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/layui-layui)Star history chart for your README
[](https://hysenlabs.com/projects/layui-layui)Was this useful?