Butterfly is a modern front-end framework that combines CSS utilities, prebuilt components, and flexible JS features to make building web apps faster and easier. Designed for developers who want speed, simplicity, and full control, Butterfly offers both a robust styling system and powerful JS tools for dynamic behavior.
- Utilities: Spacing, colors, typography, flex/grid, and more.
- Basic Components: Buttons, inputs, navbar, alerts, ranges, progress, dropdowns, etc.
- Base Styles: Default typography, resets, and responsive defaults.
- Custom Attributes: Extend HTML elements with special behavior.
- Events: Easily attach and handle custom events.
- Custom Fetch: Simplify AJAX calls with built-in utilities.
- Macros:
for,if,else,continue,breakand more for dynamic rendering. - Custom Tags: Build reusable HTML-like components.
- Animations: Lightweight JS animations for interactivity.
Manipulators (@ tags) let you declaratively handle events, timers, validations, DOM changes, and interactive behaviors directly in HTML —no extra JavaScript required.
| Manipulator | Description | Example |
|---|---|---|
@click |
Trigger function on click | <button @click="handleClick()">Click Me</button> |
@dbclick |
Trigger function on double click | <div @dbclick="doubleTap()">Double Click</div> |
@m-down |
Mouse down event | <div @m-down="startDrag()">Drag</div> |
@m-move |
Mouse move event | <div @m-move="trackMouse()"></div> |
@m-over |
Mouse over | <div @m-over="hoverEffect()">Hover</div> |
@m-up |
Mouse up | <div @m-up="stopDrag()"></div> |
@m-out |
Mouse out | <div @m-out="hoverLeave()"></div> |
@m-wheel |
Mouse wheel scroll | <div @m-wheel="zoom(event)"></div> |
@scroll |
Scroll event | <div @scroll="onScroll()"></div> |
@paste |
Paste event | <input @paste="handlePaste()"> |
@copy |
Copy event | <input @copy="handleCopy()"> |
@k-press |
Key press event | <input @k-press="keyPressed()"> |
@k-down |
Key down event | <input @k-down="keyDown()"> |
@k-up |
Key up event | <input @k-up="keyUp()"> |
@load |
Window/document load | <body @load="init()"> |
@change |
Change event | <input @change="valueChanged()"> |
@resize |
Resize body/document | <div @resize="resizeHandler()"> |
@blur |
Blur event | <input @blur="onBlur()"> |
@submit |
Form submit | <form @submit="handleSubmit()"> |
@search |
Search input | <input type="search" @search="onSearch()"> |
@input |
Input change | <input @input="updateValue()"> |
@select |
Select event | <input @select="onSelect()"> |
@reset |
Form reset | <form @reset="onReset()"> |
@focus |
Focus event | <input @focus="onFocus()"> |
@drag |
Drag event | <div @drag="dragging()"> |
@drag-start |
Drag start | <div @drag-start="startDrag()"> |
@drag-end |
Drag end | <div @drag-end="endDrag()"> |
@drag-over |
Drag over | <div @drag-over="allowDrop()"> |
@drag-enter |
Drag enter | <div @drag-enter="onEnter()"> |
@drag-leave |
Drag leave | <div @drag-leave="onLeave()"> |
@interlude |
Run function repeatedly with interval | <div @interlude="tick()" @time="1000"></div> |
@halt |
Run function after delay | <div @halt="doOnce()" @time="2000"></div> |
@countdown |
Countdown timer with callback | <span @countdown="done()" @tick="5000">((countdown))</span> |
@input-min |
Minimum input length | <input @input-min="3"> |
@input-max |
Maximum input length | <input @input-max="10"> |
@regex |
Validate input with regex | <input @regex="email"> |
@toggle |
Toggle class(es) on click | <button @toggle="active" @target="#panel">Toggle</button> |
@show |
Make element visible | <div @show>Visible</div> |
@hide |
Hide element | <div @hide>Hidden</div> |
@src |
Set src attribute |
<img @src="image.jpg"> |
@fallback |
Set alt text |
<img @fallback="No image"> |
@link |
Set href |
<a @link="https://example.com">Go</a> |
@text |
Set innerHTML | <div @text="Hello"></div> |
@placeholder |
Set input placeholder | <input @placeholder="Enter name"> |
@compute |
Evaluate expression and insert result | <span @compute="Math.random()*10"></span> |
@class |
Set className | <div @class="card"></div> |
@id |
Set id | <div @id="unique"></div> |
@clip |
Copy text to clipboard | <button @clip="this.textContent">Copy</button> |
@progress-min |
Set progress min | <progress @progress-min="0" @progress-max="100" @progress-val="25"></progress> |
@progress-max |
Set progress max | <progress @progress-min="0" @progress-max="200" @progress-val="50"></progress> |
@progress-val |
Set progress value | <progress @progress-min="0" @progress-max="100" @progress-val="75"></progress> |
@progress-color |
Set progress bar color | <progress @progress-min="0" @progress-max="100" @progress-val="50" @progress-color="#f067b2"></progress> |
@progress-bg |
Set progress background | <progress @progress-min="0" @progress-max="100" @progress-val="50" @progress-bg="#eee"></progress> |
@progress-height |
Set progress height | <progress @progress-min="0" @progress-max="100" @progress-val="50" @progress-height="20px"></progress> |
@range-color |
Set range input color | <input type="range" @range-color="#f067b2"> |
@range-bg |
Set range input background | <input type="range" @range-bg="#eee"> |
@trim |
Trim whitespace on input | <input @trim> |
@sanitize |
Remove unsafe characters | <input @sanitize="soft"> |
@log |
Log value/content to console | <div @log="this">...</div> |
- Lightweight and fast
- Fully modular: use only what you need
- Compatible with plain HTML or other frameworks
Add the following links to your HTML <head> to include Butterfly via CDN:
<!--CSS & JS-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/VTom21/butterfly@master/dist/styles/bundle.min.css">
<script type="module" src="https://cdn.jsdelivr.net/gh/VTom21/butterfly@master/dist/js/index.min.js"></script>Alternatively, you can use npm:
npm i butterfly-frameworkor yarn:
yarn add butterfly-frameworkor even bower:
bower install https://github.com/VTom21/butterfly.gitButterfly is designed to work on all modern browsers. It uses built-in utilities and standard CSS features to ensure broad compatibility.
- Chrome (latest)
- Edge (latest)
- Firefox (latest)
- Opera (latest)
- Safari (latest)
- Internet Explorer 11+ — some advanced CSS utilities and JS features may not work fully.
For the best experience, we recommend using modern browsers that support CSS Grid, Flexbox, and ES6+ JavaScript features.
© 2026 Butterfly — MIT License | Code of Conduct
Build elegant, lightweight web apps with Butterfly — Spread Your Wings, Build Faster.
