whatisgithub

What is custom-element-decorators?

patrickarlt/custom-element-decorators — explained in plain English

Analysis updated 2026-07-15 · repo last pushed 2015-10-24

10JavaScriptAudience · developerComplexity · 2/5DormantSetup · moderate

In one sentence

A JavaScript library that uses decorator markers to cut down on repetitive setup code when building custom HTML elements, handling attributes, events, and templates automatically so your components stay clean and focused.

Mindmap

mindmap
  root((repo))
    What it does
      Defines custom HTML tags
      Reduces boilerplate code
      Auto-wires attributes and events
    Key decorators
      attribute
      watchAttribute
      bindEvent
      rivetsTemplate
    Tech stack
      JavaScript
      Rivets JS
      Decorators
      Custom Elements
    Use cases
      Reusable UI components
      Profile cards
      Edit forms
    Tradeoffs
      Lightweight templating
      Tied to Rivets JS
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a reusable user profile card component with clean, decorator-driven code.

USE CASE 2

Create an edit form custom element that auto-updates its display when data changes.

USE CASE 3

Wire up event listeners on a custom HTML element without manually managing attach and detach.

USE CASE 4

Define custom HTML attributes that behave like native attributes with minimal setup.

What is it built with?

JavaScriptRivets JSDecoratorsCustom Elements

How does it compare?

patrickarlt/custom-element-decoratorsjeonghopark/collective-trajectoriesx0cban/harness
Stars101010
LanguageJavaScriptJavaScriptJavaScript
Last pushed2015-10-24
MaintenanceDormant
Setup difficultymoderateeasyhard
Complexity2/54/54/5
Audiencedeveloperdesignerops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires understanding of decorators and the Rivets JS templating library, which your elements become tied to.

No license information is provided in the repository, so permissions for use, modification, and distribution are unclear.

So what is it?

Custom Elements are a browser feature that lets you define your own HTML tags, like <user-edit-form>, that behave just like built-in tags. The catch is that building them involves a lot of repetitive setup code: defining attributes, wiring up event listeners, writing templates, and so on. This library cuts through that tedium with decorators, which are special markers you place above your class definition to automatically handle common tasks. Each decorator handles one piece of the boilerplate. @attribute lets you define custom HTML attributes on your element (like "name" or "disabled") and automatically makes them behave like native attributes, so you can set and read them as plain JavaScript properties. @watchAttribute tells the element to react when a specific attribute changes, calling a function you specify. @bindEvent automatically attaches and detaches event listeners when your element is added to or removed from the page. And @rivetsTemplate lets you provide an HTML template string with data binding, so the element's display updates automatically when its data changes. A frontend developer building a reusable component, say, a user profile card or an edit form that gets dropped into multiple pages, would use this to keep the component's code clean and focused on what it actually does rather than on plumbing. Instead of writing dozens of lines to set up attributes and listeners, you add a few decorator lines above your class and move on. The project leans on Rivets JS for its templating, which is a lightweight data-binding library. That's a deliberate choice: it gives you richer templating than raw HTML would, without pulling in a heavy framework. The tradeoff is that your elements become tied to that specific templating approach, rather than being completely framework-agnostic.

Copy-paste prompts

Prompt 1
I want to create a custom HTML element called user-profile-card using custom-element-decorators. Show me how to use the @attribute and @rivetsTemplate decorators to display a user's name and email that update automatically when the data changes.
Prompt 2
Help me set up a custom edit-form element using custom-element-decorators where the disabled attribute is reactive, when it changes, use @watchAttribute to toggle a CSS class on the form.
Prompt 3
Write a custom element with custom-element-decorators that uses @bindEvent to listen for button clicks inside it and logs a message, making sure the listener is cleaned up when the element leaves the page.
Prompt 4
I have a custom element built with custom-element-decorators and Rivets JS templating. Walk me through binding a list of items in the template and making the display update when items are added or removed.

Frequently asked questions

What is custom-element-decorators?

A JavaScript library that uses decorator markers to cut down on repetitive setup code when building custom HTML elements, handling attributes, events, and templates automatically so your components stay clean and focused.

What language is custom-element-decorators written in?

Mainly JavaScript. The stack also includes JavaScript, Rivets JS, Decorators.

Is custom-element-decorators actively maintained?

Dormant — no commits in 2+ years (last push 2015-10-24).

What license does custom-element-decorators use?

No license information is provided in the repository, so permissions for use, modification, and distribution are unclear.

How hard is custom-element-decorators to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is custom-element-decorators for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.