UXML
a lightweight, script-free component library designed specifically for web development within HTML. Whether you're a seasoned developer or new to web development, UXML simplifies the creation of interactive web applications without the need for complex JavaScript frameworks. You can create dynamic web components effortlessly without the need for any JavaScript code. With UXML, you can enhance user interfaces, handle user interactions, and build feature-rich web applications while working within the familiar HTML structure.
- Script-Free HTML UXML enables the creation of dynamic web content directly within HTML, eliminating the need for inline JavaScript.
- Simplified Interactivity Easily add interactive features to your web pages using HTML attributes and minimal configuration.
- Cross-Browser Compatibility UXML is compatible with modern web browsers, ensuring a consistent user experience.
- Lightweight
UXML is incredibly lightweight, weighing in (~3k min.js gzip'd) size, no dependency, very extendable, compatible to all major browser and
90%
smaller than popular libraries like react. - No Virtual DOM UXML doesn't rely on a virtual DOM. This results in a more efficient and simplified rendering process.
- Shallow Learning Curve UXML offers a shallow learning curve, making it accessible to developers of all skill levels. If you know HTML, you can start using UXML right away.
-
Include the UXML library in your HTML document:
<script src="https://unpkg.com/uxml.js@0.1.0/uxml.js"></script>
-
Use UXML attributes within your HTML elements to add interactivity:
<body $load="get:/pages" $swap="innerHTML"> <!-- Your HTML body --> </body>
UXML uses a simple syntax $action="event:selector"
similar on how we do a basic onclick="click()"
event handler in plain HTML. This is consist of three(3) parts, a declaration $action
, an assignment =
and a handler "event:selector"
.
- A
$
sign to define/accessUXML
inspired by jquery - A
action
to be performed on the element inspired by angularjs - A
event
to emit anUXMLEvent
or trigger anhttp
request inspired by htmx - A
:
to separate event and selector - A
selector
to "query" HTML elements or "value" of a given event i.e.url
for http request
UXML provides a range of attributes to enhance interactivity, such as $click
, $submit
, $load
, $component
and more. These attributes allow you to define behaviors without the need for JavaScript code.
<button $click="show:#hello">Show message!</button>
<div id="hello">Hello, UXML!</div>
We welcome contributions from the community to improve UXML. If you have ideas for improvements or encounter any issues, please consider opening an issue or submitting a pull request on our GitHub repository.
UXML is distributed under the MIT License. Feel free to use, modify, and distribute this library in your projects.
UXML stands on the shoulders of giants, drawing inspiration from jquery, htmx, angularjs and the need for more simplified, cleaner, and maintainable web code. Their pioneering work has illuminated our path, empowering us to develop this project. We thank the open-source community for their contributions and support in making this project possible.