Get started with riot CDN

MIT licensed

Riot.js is a minimalistic, reusable, and fast library for building component-based user interfaces.

Tags:
  • custom tags
  • custom elements
  • web components
  • virtual dom
  • shadow dom
  • polymer
  • react
  • jsx
  • minimal
  • minimalist
  • client-side
  • framework
  • declarative
  • templating
  • template
  • data binding
  • mvc
  • router
  • model
  • view
  • controller
  • riotjs
  • riot.js

Stable version

Copied!

How to start using riot CDN


// Include Riot.js library
<script src="https://cdn.cdnhub.io/riot/9.1.4/riot.min.js"></script>

// Define the Counter component
class Counter extends Riot.Component {
  constructor() {
    super();
    this.state = { count: 0 };
  }

  increment() {
    this.setState({ count: this.state.count + 1 });
  }

  render() {
    return `
      <button onclick=${() => this.increment()}>Increment</button>
      <p>Count: ${this.state.count}</p>
    `;
  }
}

// Register the Counter component
Riot.component('counter', Counter);

// Use the Counter component
<counter></counter>
Copied!
Copied!
Copied!
Copied!

All versions

0.9.10 0.9.4 0.9.5 0.9.6 0.9.7 0.9.8 0.9.9 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.7a 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.2-beta 2.2.3 2.2.4 2.3.0 2.3.0-beta 2.3.1 2.3.11 2.3.12 2.3.13 2.3.15 2.3.16 2.3.17 2.3.18 2.4.0 2.4.1 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 3.0.0 3.0.0-alpha.1 3.0.0-alpha.10 3.0.0-alpha.11 3.0.0-alpha.12 3.0.0-alpha.13 3.0.0-alpha.2 3.0.0-alpha.3 3.0.0-alpha.4 3.0.0-alpha.5 3.0.0-alpha.7 3.0.0-alpha.8 3.0.0-alpha.9 3.0.0-rc 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.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