banira init

Scaffold a starter vanilla web component — a TypeScript source file plus a demo page wired for banira serve.

Usage

$ banira init <tag-name> [dir] [options]

Arguments

ArgumentDescription
<tag-name>Custom element tag name (must contain a hyphen).
[dir]Directory to scaffold into. (default: .)

Options

OptionDescription
--forceOverwrite existing files instead of leaving them untouched.
--form-associatedScaffold a form-associated element (static formAssociated = true + ElementInternals form/validation wiring).
--ariaScaffold an ARIA role/state-reflecting element (ElementInternals.role/ariaChecked, keyboard support, @role in the manifest).
--hydrateScaffold a component that hydrates a prerendered Declarative Shadow DOM root (adopt-or-render, no flash).

Examples

scaffold into src/
$ banira init my-button src
a checkbox-role toggle (ElementInternals)
$ banira init my-toggle src --aria

Notes

The generated source uses shadow DOM, an observed attribute/property, an event, and the @slot / @csspart / @cssprop / @fires jsdoc tags that banira's manifest and doc tooling read. Existing files are left untouched unless --force is given.

The variant flags scaffold a different starter: --form-associated (a <form>-participating control), --aria (an accessible toggle whose role/state is exposed via ElementInternals), or --hydrate (a component that adopts its prerendered DSD root on the client). Pass one.