Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

4 Commits

Repository files navigation

Block.js

Block.js is a lightweight JavaScript library designed to simplify the creation and manipulation of block-based user interfaces. It provides a small set of tools and components that make it easy to build interactive and responsive layouts using a block-based approach.

Goals/Features

  • Lightweight: Minimal footprint, ensuring fast load times and performance.
  • Customizable: Highly customizable components to fit your design needs.
  • Extensible: Easily extendable with plugins and custom components.

Usage

Here's a basic example of how to use Block.js:

<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport" content="width=device-width, initial-scale=1.0"><title>Block.js Example</title><scriptsrc="block.js"></script></head><body><divid="app"></div><script>constapp=document.getElementById('app');constblock=newBlock({content: 'Hello, Block.js!'});app.appendChild(block.render());</script></body></html>

Using BlockTemplate

BlockTemplate allows you to define reusable templates for your blocks. Here's an example:

<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport" content="width=device-width, initial-scale=1.0"><title>BlockTemplate Example</title><scriptsrc="block.js"></script></head><body><divid="app"></div><script>constapp=document.getElementById('app');// Define a templateconstMyTemplate=newBlockTemplate({blocks: [{type: 'Block',content: 'Hello, BlockTemplate!'},{type: 'ButtonBlock',content: 'Click Me'},{type: 'ListBlock',items: ['Item 1','Item 2','Item 3']}],components: {
ButtonBlock,
ListBlock,
ListItemBlock
}});// Render the templateapp.innerHTML=MyTemplate.toString();</script></body></html>

About

block.js is an experimental way to render HTML structures and components with JavaScript

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages