JSX-like syntax using standard JavaScript tagged templates, with no transpiler required.
HTM (Hyperscript Tagged Markup) is a lightweight JavaScript library that provides JSX-like syntax using standard tagged template literals. It allows developers to write declarative UI code without needing a transpiler, making it ideal for development directly in the browser or in environments without build tooling. The library can be bound to any hyperscript-style function, making it compatible with React, Preact, and other virtual DOM libraries.
Frontend developers working with React, Preact, or similar virtual DOM libraries who want to avoid build tooling or write UI components directly in the browser. It's also suitable for projects where minimal bundle size is a priority.
Developers choose HTM for its zero-dependency approach, tiny footprint, and the ability to use JSX-like syntax without a build step. Its framework-agnostic design and enhanced syntax features offer a flexible and efficient alternative to traditional JSX.
Hyperscript Tagged Markup: JSX alternative using standard tagged templates, with compiler support.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Weighs less than 600 bytes when used directly, and can compile to zero bytes with Babel, as stated in the README's size claims, minimizing bundle overhead.
Enables JSX-like syntax in plain JavaScript using tagged templates, allowing development directly in browsers or without transpilers, perfect for prototyping.
Can bind to any hyperscript-style function, making it compatible with React, Preact, or custom renderers, as shown in the advanced usage examples.
Supports optional HTML quotes, component end-tags, and multiple root elements, improving ergonomics over standard JSX with less boilerplate.
Includes template caching and a mini version for fine-grained control, helping reduce runtime overhead in virtual DOM applications.
Uses `<${Component}>` for components and `...${props}` for spreads, which deviates from JSX and can confuse developers or break existing tooling expectations.
Default template caching can lead to unintended node sharing, requiring manual fixes like using `htm/mini` or modifying the h function, as noted in the caching section.
Lacks deep integration with TypeScript or advanced IDE features beyond basic syntax highlighting, making it less suitable for type-heavy projects.