Sigment is a minimal reactive framework for building fast, modern UIs — no virtual DOM, no JSX, no transpilation. Write plain JavaScript with simple tag functions and reactive signals.
Install Sigment in your project with npm or yarn:
npm install sigment
# or
yarn add sigment
Import the functions you need in your JavaScript/TypeScript files:
import { signal } from 'sigment';
function Counter() {
const [count, setCount] = signal(0);
return div({ id: 'counter' },
button({ onClick: () => setCount(count() + 1) }, 'Increment'),
p(() => `Count is: ${count()}`)
);
}
document.body.appendChild(Counter());
If you want to try Sigment in the browser without a build step, use a CDN that serves npm packages as ES modules, for example Skypack:
<script type="module">
import { signal } from 'https://cdn.skypack.dev/sigment';
function Counter() {
const [count, setCount] = signal(0);
return div({ id: 'counter' },
button({ onClick: () => setCount(count() + 1) }, 'Increment'),
p(() => `Count is: ${count()}`)
);
}
document.body.appendChild(Counter());
</script>
signal(initialValue)
creates reactive state — returns [getter, setter]
.count()
; update with the setter setCount(newValue)
.div()
, button()
.onClick
), attributes, styles, etc.function App() {
return div({ className: 'app' },
Counter()
);
}
document.body.appendChild(App());
const [count, setCount] = signal(0);
const counter = div({ id: 'counter' },
button({ onClick: () => setCount(count() + 1) }, 'Increment'),
p(() => `Count is: ${count()}`)
);
document.body.appendChild(counter);
Function | Description |
---|---|
signal(v) | Create reactive state — returns [getter, setter] |
div(props, ...children) | Create a <div> element with props and children |
button(props, ...children) | Create a <button> element |
other tag functions | For all common HTML tags |
Q: Can I use JSX?
A: Sigment does not require JSX; build UI with plain JS functions.
Q: Does Sigment have a virtual DOM?
A: No, it updates the real DOM directly for better performance.
Q: Do I need a build step?
A: No build step or transpilation is needed.