Skip to content
search.html
html
<kb-input name="dog">…</kb-input>
dog/changed:method/get
api.html
html
<kb-fetch name="api" url="…/search?q={}">
  <kb-on value="dog/changed:method/get"></kb-on>
</kb-fetch>

One arc. When dog dispatches changed, <kb-fetch> calls its own get — no listener written by hand.

Web Components · Zero dependencies · MIT

Components that talk to each other.

No framework. No state to manage.

A declarative event bus wires elements together right in the markup — an arc, source/event:type/sink, replaces the glue code you'd otherwise write by hand to make two components agree.

01 — the problem

Every interface ends up needing a framework — just so two components can talk.

Two elements on a page rarely need to share state. They need to agree that something happened: a value changed, a request finished, a modal should close. That's not a state-management problem — it's plumbing. But without a shared channel for it, the plumbing is exactly what pulls a framework in: somewhere has to hold a reference to both elements, listen on one, and call the other.

kuba's bet is that the plumbing is the part worth automating, and the business rule is the part worth writing by hand. An arc replaces the plumbing; your code stays free to do the rest.

Without kuba — the wiring is imperative
jsx
function DogSearch() {
  const [query, setQuery] = useState('')
  const [breeds, setBreeds] = useState([])
  const [failed, setFailed] = useState(false)

  useEffect(() => {
    if (!query) return
    const controller = new AbortController()
    fetch(`https://api.thedogapi.com/v1/breeds/search?q=${query}`, {
      headers: { 'x-api-key': 'DEMO-API-KEY' },
      signal: controller.signal,
    })
      .then((res) => res.json())
      .then(setBreeds)
      .catch(() => setFailed(true))
    return () => controller.abort()
  }, [query])

  return (
    <div>
      <input value={query} onChange={(e) => setQuery(e.target.value)} />
      {failed ? null : breeds.map((breed) => (
        <Card
          key={breed.id}
          name={breed.name}
          bredFor={breed.bred_for}
          lifeSpan={breed.life_span}
          temperament={breed.temperament}
        />
      ))}
    </div>
  )
}
With kuba — the wiring is markup
html
<kb-stack direction="column" spacing="xs" width="fill">
  <kb-input name="dog" width="fill">
    <kb-label>Dog Breed Search</kb-label>
    <kb-helper>Try 'akita' or 'corgi'.</kb-helper>
  </kb-input>

  <kb-render layout="grid">
    <template>
      <kb-card>
        <kb-inset side="top">
          <kb-cover src="{image.url}"></kb-cover>
        </kb-inset>
        <kb-text family="highlight" weight="medium" size="xs" color="primary-dark">{name}</kb-text>
        <kb-stack direction="column" spacing="quarck">
          <kb-text size="xxxs"><strong>Bred for:</strong> {bred_for}</kb-text>
          <kb-text size="xxxs"><strong>Life span:</strong> {life_span}</kb-text>
          <kb-text size="xxxs"><strong>Temperament:</strong> {temperament}</kb-text>
        </kb-stack>
      </kb-card>
    </template>
    <kb-on value="api/succeeded:method/render"></kb-on>
    <kb-on value="api/failed:method/clear"></kb-on>
  </kb-render>
</kb-stack>

<kb-fetch name="api" url="https://api.thedogapi.com/v1/breeds/search?q={}">
  <kb-headers key="x-api-key" value="DEMO-API-KEY"></kb-headers>
  <kb-on value="dog/changed:method/get"></kb-on>
</kb-fetch>

No useState, no useEffect, no AbortController written by hand — <kb-fetch> aborts a stale request on its own. Full walkthrough: Search as you type.

0 useState.
0 useEffect.

Same breed search.
Same behavior.
Just markup.

02 — how it works

One arc. Four parts.

Every kuba element that reacts to another carries an on attribute (or a <kb-on>) describing one connection — an arc.

arc

dogsource/changedevent:methodtype/getsink

source

The name of the element that dispatches the event.

event

The event name — changed, succeeded, failed, whatever the source publishes.

type

What the arc drives: method calls a function, property assigns a value, attribute writes to the DOM.

sink

What gets called, assigned, or set on the element that carries the arc.

Reads as: when the element named dog dispatches changed, call this element's get method with the event's payload. Echo listens for the native CustomEvent, resolves the source by name, and makes the call. No element holds a reference to another.

not.txt

What kuba is not

kuba does not model your domain. It has no idea what a "dog breed" or a "user" is — it only knows that one element published an event and another asked to be called when that happens. The arc is the whole contract: what the payload means, and what to do with it, stays entirely up to the elements at each end.

kuba removes the communication glue between components. It does not replace the decisions your application still has to make.

zero-framework.txt

Zero framework

Every kuba element is a standard custom element, registered once, that runs on CustomEvent — a browser capability, not a library's. Nothing here needs a bundler, a runtime, or a specific backend. Two <script> and <link> tags is the entire installation; drop them into a PHP template, a Rails view, a Django template, or a static .html file, and every tag below works exactly the same way.

a11y.txt

Accessible by default

Keyboard support and ARIA attributes are not an afterthought bolted onto the markup — they live in the mixins every element is built from. <kb-input> delegates validation to the Constraint Validation API; form elements report custom states like :state(invalid) through ElementInternals instead of reimplementing what <form> already does natively.

03 — where it fits

Where kuba sits

comparison.tbl
Hand-rolled Web ComponentsComponent libraryFull frameworkkuba
Cross-component wiringWritten by hand, every timeNot its jobA state runtimeDeclarative arcs in markup
Build stepNoneUsually noneRequiredNone
Runtime shipped to the browserNoneVariesA framework runtimeZero dependencies
Backend requirementNoneNoneOften a matching backendNone — any stack
Where state livesWherever you put itWherever you put itA JS state treeThe DOM and your own objects

04 — try it

Change an attribute.
Watch it react.

The same search-dog-breeds feature from the top of this page, editable live — change an attribute, add an arc, see it react immediately.

Edit
Live
Dog Breed Search Try 'akita' or 'corgi'.

Questions

Does kuba replace my framework?

It replaces the communication glue between components, not the decisions your application makes. kuba does not model your domain: the arc is the whole contract, and what the payload means stays with the elements at each end.

Do I need a bundler or a build step?

No. Every element is a standard custom element, registered once, running on CustomEvent. A <script> and a <link> are the whole installation.

Does it work with my backend?

With any of them. In a static page, a PHP template, a Rails view, or a Django template, every tag works the same way.

Where does state live?

In the DOM and in your own objects. No element holds a reference to another: they connect through a name and an event.

Is it accessible?

Keyboard support and ARIA live in the mixins every element is built from. Form fields use the Constraint Validation API and report state through ElementInternals.