Material Design Style Checkboxes In jQuery - matd_checkbox

File Size: 14.6 KB
Views Total: 875
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
Material Design Style Checkboxes In jQuery - matd_checkbox

The matd_checkbox jQuery plugin lets you create customizable, Material Design style checkboxes with support for indeterminate state.

See also:

How to use it:

1. Add jQuery library and the jQuery matd_checkbox plugin's files to the page.

<link rel="stylesheet" href="matd_checkbox.css">
<script src="" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="matd_checkbox.min.js"></script>

2. Attach the function matd_checkbox() to the regular checkbox input and done.

<input id="example" type="checkbox">

3. Enable the indeterminate state. Default: false.

  partial: true

4. Check the checkbox input on init. Default: false.

  checked: true

5. Customize the colors of the Material Design checkbox.

  clicked_color: '',
  outline_color: '',
  style_color: '',
  style_out_color: ''

6. Customize the template of the Material Design checkbox.

  templateString: '<span class="matd_cb_container"><span class="flex-base matd_cb_inner" data-checked="${checked}" data-indeterminate="${partial}"><svg class="matd_cb_svg" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation"><path class="matd_cb_off" style="${style_out_color}" d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path><path class="matd_cb_on" style="${style_color}" d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path><path class="matd_cb_part" style="${style_color}" d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"></path></svg><input id="mtdcb_${id}" ${placeholder} class="matd_cb_input" type="checkbox" value="chk_val"></span></span>',

7. Check/uncheck the checkbox programmatically.

$('#example').matd_checkbox('go_check', true);
$('#example').matd_checkbox('go_check', false);

This awesome jQuery plugin is developed by CBairdAsh. For more Advanced Usages, please check the demo page or visit the official website.