riot/riot
{ "createdAt": "2013-09-27T05:21:01Z", "defaultBranch": "main", "description": "Simple and elegant component-based UI library", "fullName": "riot/riot", "homepage": "https://riot.js.org", "language": "JavaScript", "name": "riot", "pushedAt": "2025-11-21T22:08:12Z", "stargazersCount": 14867, "topics": [ "client-side", "customelement", "customelements", "customtags", "elegant", "framework", "javascript", "lite", "minimal", "simple", "view", "webcomponents" ], "updatedAt": "2025-11-25T21:32:16Z", "url": "https://github.com/riot/riot"}Simple and elegant component-based UI library
Section titled “Simple and elegant component-based UI library”[![Build Status][ci-image]][ci-url] [![MIT License][license-image]][license-url] [![Join the discord community channel][discord-image]][discord-url] [![Join the chat (ja) at https://riot-jp-slackin.herokuapp.com/][slack-ja-image]][slack-ja-url] [![OpenCollective Backers][backer-badge]][backer-url] [![OpenCollective Sponsors][sponsor-badge]][sponsor-url]
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![jsDelivr Hits][jsdelivr-image]][jsdelivr-url] [![Coverage Status][coverage-image]][coverage-url] ![Riot Size][lib-size] [![Code Quality][qlty-image]][qlty-url]
[![Sauce Test Status][saucelabs-image]][saucelabs-url]
Custom components • Concise syntax • Simple API • Tiny Size
Section titled “Custom components • Concise syntax • Simple API • Tiny Size”Riot brings custom components to all modern browsers. It is designed to offer you everything you wished the native web components API provided.
Tag definition
Section titled “Tag definition”<timer> <p>Seconds Elapsed: { state.time }</p>
<script> export default { tick() { this.update({ time: ++this.state.time }) }, onBeforeMount(props) { // create the component initial state this.state = { time: props.start, }
this.timer = setInterval(this.tick, 1000) }, onUnmounted() { clearInterval(this.timer) }, } </script></timer>Mounting
Section titled “Mounting”// mount the timer with its initial propsriot.mount('timer', { start: 0 })Nesting
Section titled “Nesting”Custom components let you build complex views with HTML.
<timetable> <timer start="0"></timer> <timer start="10"></timer> <timer start="20"></timer></timetable>HTML syntax is the de facto language on the web and it’s designed for building user interfaces. The syntax is explicit, nesting is inherent to the language and attributes offer a clean way to provide options for custom tags.
Performant and predictable
Section titled “Performant and predictable”- Absolutely the smallest possible amount of DOM updates and reflows.
- Fast expressions bindings instead of virtual DOM memory performance issues and drawbacks.
- One way data flow: updates and unmounts are propagated downwards from parent to children.
- No “magic” or “smart” reactive properties or hooks
- Expressions are pre-compiled and cached for high performance.
- Lifecycle methods for more control.
Close to standards
Section titled “Close to standards”- No proprietary event system.
- Future proof thanks to the javascript module syntax.
- The rendered DOM can be freely manipulated with other tools.
- No extra HTML root elements,
data-attributes or fancy custom attributes. - No new syntax to learn.
- Plays well with any frontend framework.
Use your dearest language and tools
Section titled “Use your dearest language and tools”- Create components with CoffeeScript, Jade, LiveScript, Typescript, ES6 or any pre-processor you want.
- Build with @riotjs/cli, webpack, Rollup, parcel, Browserify.
- Test however you like; you can load your riot tags directly in node
Powerful and modular ecosystem
Section titled “Powerful and modular ecosystem”The Riot.js ecosystem is completely modular, it’s designed to let you pick only the stuff you really need:
- @riotjs/cli - CLI to locally compile your tags to javascript
- @riotjs/ssr - Super simple server side rendering
- @riotjs/hydrate - Hydration strategy for your SPA
- @riotjs/route - Isomorphic router
- @riotjs/lazy - Lazy components loader
- @riotjs/hot-reload - Live reload plugin
- @riotjs/compiler - Advanced tags compiler
- @riotjs/parser - HTML parser
- @riotjs/dom-bindings - Expressions based template engine
- @riotjs/custom-elements - native custom elements implementation
CDN hosting
Section titled “CDN hosting”How to contribute
Section titled “How to contribute”If you are reading this it’s already a good sign and I am thankful for it! I try my best working as much as I can on riot but your help is always appreciated.
If you want to contribute to riot helping the project maintenance please check first the list of open issues to understand whether there is a task where you could help.
Riot is mainly developed on UNIX systems so you will be able to run all the commands necessary to build and test the library using our [Makefile]!(Makefile). If you are on a Microsoft machine it could be harder to set up your development environment properly.
Following the steps below you should be able to properly submit your patch to the project
1) Clone the repo and browse to the riot folder
Section titled “1) Clone the repo and browse to the riot folder”git clone git@github.com:riot/riot.git && cd riot2) Set up your git branch
Section titled “2) Set up your git branch”git checkout -b feature/my-awesome-patch3) Install the npm dependencies
Section titled “3) Install the npm dependencies”npm i4) Build and test riot using the Makefile
Section titled “4) Build and test riot using the Makefile”# To build and test riot$ make riot
# To build without testing$ make raw5) Pull request only against the main branch making sure you have read [our pull request template]!(.github/PULL_REQUEST_TEMPLATE.md)
Section titled “5) Pull request only against the main branch making sure you have read [our pull request template]!(.github/PULL_REQUEST_TEMPLATE.md)”6) Be patient
Section titled “6) Be patient”Credits
Section titled “Credits”Riot is actively maintained with :heart: by:
Gianluca Guarini |
Many thanks to all smart people from all over the world who helped improving it.
Official Website
Section titled “Official Website”Backers
Section titled “Backers”Support us with a monthly donation and help us continue our activities. [Become a backer][support-url]
[![Backers][backers-image]][support-url]
Sponsors
Section titled “Sponsors”Become a sponsor to get your logo on our README. [Become a sponsor][support-url]
[![Sponsors][sponsors-image]][support-url]
Thanks
Section titled “Thanks”Special thanks to Browserstack for their support
|
|
[ci-image] !: https://img.shields.io/github/actions/workflow/status/riot/riot/test.yml?style=flat-square [ci-url] !: https://github.com/riot/riot/actions [license-image] !: https://img.shields.io/badge/license-MIT-000000.svg?style=flat-square [license-url] !: LICENSE.txt [npm-version-image] !: https://img.shields.io/npm/v/riot.svg?style=flat-square [npm-downloads-image] !: https://img.shields.io/npm/dm/riot.svg?style=flat-square [npm-url] !: https://npmjs.org/package/riot [saucelabs-image] !: https://saucelabs.com/browser-matrix/testsriotjs.svg?1 [saucelabs-url] !: https://saucelabs.com/u/testsriotjs [coverage-image] !: https://qlty.sh/gh/riot/projects/riot/coverage.svg [coverage-url] !: https://qlty.sh/gh/riot/projects/riot [discord-url] !: https://discord.gg/PagXe5Y [discord-image] !: https://img.shields.io/badge/DISCORD-JOIN_CHANNEL_%E2%86%92-7289da.svg?style=flat-square [slack-ja-image] !: https://img.shields.io/badge/SLACK_(ja)-JOIN_CHAT_%E2%86%92-551a8b.svg?style=flat-square [slack-ja-url] !: https://riot-jp-slackin.herokuapp.com/ [qlty-image] !: https://qlty.sh/gh/riot/projects/riot/maintainability.svg [qlty-url] !: https://qlty.sh/gh/riot/projects/riot [jsdelivr-image] !: https://data.jsdelivr.com/v1/package/npm/riot/badge [jsdelivr-url] !: https://www.jsdelivr.com/package/npm/riot [backer-url] !: #backers [backer-badge] !: https://opencollective.com/riot/backers/badge.svg?color=blue [sponsor-url] !: #sponsors [sponsor-badge] !: https://opencollective.com/riot/sponsors/badge.svg?color=blue [support-url] !: https://opencollective.com/riot#support [lib-size] !: https://img.badgesize.io/https://unpkg.com/riot/riot.min.js?compression=gzip [backers-image] !: https://opencollective.com/riot/backers.svg [sponsors-image] !: https://opencollective.com/riot/sponsors.svg