Usage Guide
Welcome to the Ikea.js usage guide! Here, you’ll learn how to use Ikea.js to create HTML elements and manage your web page. Ikea.js lets you assemble UI components using JavaScript, much like assembling furniture from Ikea.
Getting Started
To use Ikea.js in your project, include the script in your HTML:
<script src="https://cdn.jsdelivr.net/gh/linuxfandudeguy/ikea.js@ikeajs0.3/ikea.min.js"></script>
You can then use Ikea.js functions to create HTML elements. Here’s a basic example:
document.addEventListener('DOMContentLoaded', function() {
// Create a button with Ikea.js
var button = Button({
innerHTML: 'Click Me',
class: 'bg-blue-500 text-white px-4 py-2 rounded'
});
// Add button to the body
document.body.appendChild(button);
});
Applying Classes
To apply classes to an element, use the class
property in the props object:
var div = Div({
class: 'container mx-auto p-4',
children: [
H1({ innerHTML: 'Welcome to Ikea.js' })
]
});
document.body.appendChild(div);
I finally did it, I made my own HTML framework in JavaScript. I was inspired by frameworks like Angular, Vue, and React, and look at where I am now. - lelbois, project maintainer