JavaScript Library for Rendering Anything as HTML Checkboxes | Checkboxland

Checkboxland is a JavaScript library for displaying anything as HTML checkboxes. You can use it to display animations, text, and arbitrary data. It also supports plugins, so you can build more powerful APIs on top of it.

Checkboxland is dependency-free, framework-neutral, and fun! đŸ™ƒ

checkbox in html, how to make checkbox checked by default in javascript, multiple checkbox in html, checkbox javascript, input typecheckbox checked

How to make use of it:

Install & Download:

# NPM
$ npm install checkboxland --save

1. Import the Checkboxland as an ES module.

import { Checkboxland } from 'checkboxland';

// or from a CDN
import { Checkboxland } from 'https://unpkg.com/checkboxland?module';

2. Import plugins if wanted.

import print from './plugins/print/print.js';
import marquee from './plugins/marquee.js';
import transitionWipe from './plugins/transitionWipe.js';
import dataUtils from './plugins/dataUtils.js';

// Add built-in plugins
Checkboxland.extend(print);
Checkboxland.extend(marquee);
Checkboxland.extend(transitionWipe);
Checkboxland.extend(dataUtils);

3. Create a container by which you need to render the checkbox grid.

<div id="example"></div>

4. Create a brand new Checkboxland instance and decide the dimension of the checkbox grid.

const example = new Checkboxland({ 
      dimensions: '8x8', 
      selector: '#example' 
});

5. Prepare your information in a JS array that consists of 0 (unchecked) and 1 (checked).

const myData = [
      [0,1,1,0,0,1,1,0],
      [1,0,0,1,1,0,0,1],
      [1,0,0,0,0,0,0,1],
      [1,0,0,0,0,0,0,1],
      [0,1,0,0,0,0,1,0],
      [0,0,1,0,0,1,0,0],
      [0,0,0,1,1,0,0,0]
];

6. Render a checkbox grid with the info you present.

example.setData(myData,{
  // the x-coordinate where the text should start on the checkbox grid. Default: 
  x: 0,

  // The y-coordinate where the text should start on the checkbox grid. Default: 0.
  y: 0,

  // if the text data won't fill the whole checkbox grid, you can (0, 1, or 2) which will then be used to fill the leftover areas. 
  fillValue: undefined
});

7. Get the value of a checkbox within the grid. Returns 0 or 1.

example.getCheckboxValue(x, y);

8. Set the checkbox value.

example.setCheckboxValue(x, y, 0 or 1);

9. Get the info.

example.getData();

10. Clear all information.

example.clearData();

11. Use the print plugin.

example.print(text,{

  // character data for a custom font
  font: {},

  //  returns a data matrix for the text instead of updating the checkbox grid
  dataOnly: false,

  // the x-coordinate where the text should start on the checkbox grid. Default: 
  x: 0,

  // The y-coordinate where the text should start on the checkbox grid. Default: 0.
  y: 0,

  // if the text data won't fill the whole checkbox grid, you can (0, 1, or 2) which will then be used to fill the leftover areas. 
  fillValue: undefined
  
})

12. Use the marquee plugin.

example.marquee(data, {

  // repeat the animation
  repeat: false,

  // interval in ms
  interval: 200

  // fill the leftover areas if the scrolling data doesn't fill the whole checkbox grid
  fillValue: 0,

  // callback
  callback: function(){}

})

13. Use the transitionWipe plugin.

example.transitionWipe(newData, {

  // ltr (left-to-right) and rtl (right-to-left)
  direction: 'ltr',

  // interval in ms
  interval: 200

  // fill the leftover areas if the scrolling data doesn't fill the whole checkbox grid
  fillValue: 0,

  // callback
  callback: function(){}
  
})

14. Use the dataUtils plugin.

// actionName:
// invert: inverts the provided matrix
// pad: adds padding around the provided matrix
example.dataUtils(actionName, matrix, {
  top: 0
  bottom: 0
  left: 0
  right: 0
  all: 0
})

15. Get an empty matrix with the scale of the present checkbox grid.

example.getEmptyMatrix({
  // the width & height of the returned matrix
  width: 0,
  height: 0,

  // the value you want to pre-populate the returned matrix with. 
  fillValue: 0
});

Render Anything Using HTML Checkboxes, Checkboxland Plugin/Github, html checkbox value truefalse, html checkbox checked


See Demo And Download

Official Website(bryanbraun): Click Here

This superior jQuery/javascript plugin is developed by bryanbraun. For extra Advanced Usages, please go to the official website.

Related Posts

Iconpicker-Bootstrap-5

[Icon Picker] Iconpicker for Bootstrap 5 Icons Library

Bootstrap 5-based icon picker which supports any icon libraries like Bootstrap Icons, Font Awesome[fontawesome.com], etc. Must Read: 1000+ Pixel Perfect SVG Icons For Vue Components | Unicons How…

bootstrap-multiple-image-upload-with-preview

Bootstrap Multiple Image Upload with Preview and Delete | ImagesLoader

ImagesLoader is a standard bootstrap image upload plugin that provides an easy-to-use and nice-looking interface for uploading multiple images to a web server. Must Read: HTML 5…

Animating-Split-Flap-Displays-fallblatt

A Lightweight jQuery Plugin for Animating Split-Flap Displays | fallblatt

fallblatt is a lightweight jQuery plugin for animating split screens. This jQuery plugin allows you to include such offers in your web application. Everything from virtual departure…

bootstrap-5-dark-theme

Dark & Light Switch Mode Toggle for Bootstrap 5

Switching to dark mode is done by toggling HTML tags that include -dark or -light as a category. It is made by manipulating the DOM with JavaScript. The text color also changes depending…

jQuery-SyoTimer-Plugin

jQuery Plugin for Countdown Timer on HTML Page | SyoTimer

yoTimer jQuery plugin allows you to create digital style countdowns/periodic timers on the webpage, with callbacks support and timezone/translation customization. Features Periodic count with the specified period…

vue-js-periodic-table

Dynamic, Data-driven Periodic Table built with Vue.js

Periodicity is a dynamic, data-driven periodic table created with Vue.js that uses D3 animations and graphs to show the beauty of periodic trends. Built With vue.js (component…