Skip to content

Getting Started

Terminal window
bun add @beardcoder/stitch-js
# or
npm install @beardcoder/stitch-js

Add interactive behavior to your HTML with just a few lines of JavaScript:

<div data-tabs>
<div data-tab-list>
<button data-tab>One</button>
<button data-tab>Two</button>
</div>
<div data-tab-panel>Content one</div>
<div data-tab-panel>Content two</div>
</div>
<script type="module">
import { enhance, tabs } from "@beardcoder/stitch-js";
enhance("[data-tabs]", tabs());
</script>

All sizes are minified + gzipped. Tree-shaking ensures you only pay for what you import.

Importminmin+gz
Full bundle (everything)6,284 B2,709 B
Core only (enhance, defineComponent, etc.)2,130 B1,116 B
Store only (createStore, computed, effect)748 B361 B
Core + Tabs2,789 B1,387 B
Core + Accordion2,841 B1,393 B
Core + Form2,571 B1,352 B
Core + Animate2,156 B1,131 B

For a declarative setup, use register and autoInit:

import { register, autoInit, tabs, accordion } from "@beardcoder/stitch-js";
register("[data-tabs]", tabs());
register("[data-accordion]", accordion());
autoInit(); // runs on DOMContentLoaded