Get started with preact-custom-element CDN

MIT licensed

Lightweight library for creating reusable, composable Preact components as custom elements.

Tags:
  • preact
  • web
  • components
  • custom
  • element

Stable version

Copied!

How to start using preact-custom-element CDN


import { h, Component } from 'preact';
import 'preact-custom-element/dist/window-patches';

class MyCustomElement extends Component {
  render() {
    return (
      <div>
        <h1>Hello, I'm a custom element!</h1>
      </div>
    );
  }
}

customElements.define('my-custom-element', MyCustomElement);
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions