Recep Kütük

Canon Component Library

Role
Creator & Maintainer
Scope
Design, Front-end Development, Documentation

In the early 2000s I built my first websites in Dreamweaver and FrontPage, then watched them fall apart in another browser. Looking for the reason led me to the browser wars, the Web Standards Project and finally Dave Shea’s CSS Zen Garden: one HTML file, hundreds of designs, and not a single change to the markup. It’s why I learned HTML and CSS properly.

Twenty years of interface work later, most of it textboxes, checkboxes and radio buttons wrapped in more and more tooling, I still wanted that simplicity back. I could picture it but couldn’t build it. This year, working with Claude, I finally did. Canon is my first open-source project.

Canon is a component library for internal tools (tables, forms, dialogs) written in plain HTML. You add two lines from a CDN or npm, with no build step, and it works with whatever already renders your pages: Django, Rails, Laravel, Go, htmx or React. 67 of its 68 components work without JavaScript, accessibility is built into each component’s markup, light and dark modes follow the visitor’s system on their own, and six themes restyle the same markup without touching a line of HTML.

<link rel="stylesheet" href="css/canon/canon.css">

<button type="button" class="canon-button">
  <span class="canon-button-label">Save</span>
</button>
You say what it is. The theme says how it looks. A button becomes what its attributes say, and the theme draws it. Try the controls: each one types its attribute into the markup below, and the theme only changes the stylesheet link. This is Canon running, not a picture of it, and it follows this site’s dark mode switch.
An orders table with a search field and Filters, Columns and Dark buttons, showing six of twelve orders.
One table, from markup. Filter by any column and the filter stays on screen as a chip. Hide, show, reorder and pin columns; a pinned column stays put while the rest scroll under it. Select a page, then every matching row, and a bar rises with the count and your actions. Dark mode needs nothing extra. All of it comes from the table’s HTML and a few data- attributes, with no configuration object.
<div class="canon-date" data-inline>
  <input
    type="date"
    name="delivery"
    value="2026-11-18"
    min="2026-11-16"
    max="2027-03-31"
    data-weekdays="1-5"
    data-unavailable="2026-11-26 2026-12-24/2026-12-25"
  >
</div>
A calendar, live. One native date input with its rules as attributes: weekdays only, a window from min to max, and the days that are taken. Those days are greyed and can’t be picked, by pointer or keyboard. canon.js draws the calendar the same way in every browser; without it, the browser’s own date field still sends the same value.
The upper half of the Canon board in light mode, seen from above at a slight angle: notification switches, accent swatches, a toolbar with Create and Export, a Create action dialog, a sign-in code, a colour picker, system status, an “Are you sure?” dialog with Delete account, a Snooze calendar and a shareable link card.
Your CSS always wins. All of Canon sits in one cascade layer, so any rule you write overrides it, with no !important and no specificity battles. Adjusting a component for your product is an ordinary line of CSS, not a fork.
The lower half of the Canon board in dark mode, seen from above at a slight angle: an orders table with status badges, a music player, team and name selects, a login form, a location form with a map, a profile card, a Columns panel, a menu and a Travelers counter.
Dark mode isn’t a second stylesheet. Every colour in Canon is written once, as a light and dark pair, so the two modes can’t drift apart. The page’s color-scheme picks the side, whether that follows the system or a switch like this site’s.
Every pixel has a reason. Padding, icon, gap and corner radius all step up together from small to large, so every size looks like the same button. The label’s side gets a little more room than the icon’s, so the two look evenly spaced rather than merely measuring the same. Forms are built from the same steps, so labels, fields and buttons line up without anyone nudging them into place.

What it isn’t. Canon is for the screens behind a product: admin panels, back offices, internal tools. It isn’t a JavaScript component library, an app framework or a kit for marketing sites, and at version 0.2 it’s still young. If your server already renders HTML, it’s two lines away:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/canon-ui@0.2.1/css/canon/canon.css">
<script src="https://cdn.jsdelivr.net/npm/canon-ui@0.2.1/js/canon.js" defer></script>

More works