├── .github
├── CONTRIBUTING.md
├── ISSUE_TEMPLATE.md
├── PULL_REQUEST_TEMPLATE.md
└── stale.yml
├── CHANGE.md
├── LICENSE.md
├── README.md
├── bower.json
├── composer.json
├── css
├── checkbox-x.css
├── checkbox-x.min.css
├── theme-krajee-flatblue.css
└── theme-krajee-flatblue.min.css
├── examples
├── bs3.html
├── bs4.html
└── bs5.html
├── img
└── loading.gif
├── js
├── checkbox-x.js
└── checkbox-x.min.js
├── package.json
└── sass
├── checkbox-x.scss
└── theme-krajee-flatblue.scss
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Contributing to bootstrap-checkbox-x
2 | ====================================
3 | Looking to contribute something to bootstrap-checkbox-x? **Here's how you can help.**
4 |
5 | Please take a moment to review this document in order to make the contribution
6 | process easy and effective for everyone involved.
7 |
8 | Following these guidelines helps to communicate that you respect the time of
9 | the developers managing and developing this open source project. In return,
10 | they should reciprocate that respect in addressing your issue or assessing
11 | patches and features.
12 |
13 | Using the issue tracker
14 | -----------------------
15 | When [reporting bugs][reporting-bugs] or
16 | [requesting features][requesting-features], the
17 | [issue tracker on GitHub][issue-tracker] is the recommended channel to use.
18 |
19 | The issue tracker **is not** a place for support requests. Refer the
20 | [plugin documentation](http://plugins.krajee.com/checkbox-x),
21 | [plugin demos](http://plugins.krajee.com/checkbox-x/demo), and / or refer to the
22 | [webtips Q & A forum](http://webtips.krajee.com/questions) which are the better places to get help.
23 |
24 | Reporting bugs with bootstrap-checkbox-x
25 | ----------------------------------------
26 | We really appreciate clear bug reports that _consistently_ show an issue
27 | _within bootstrap-checkbox-x_.
28 |
29 | The ideal bug report follows these guidelines:
30 |
31 | 1. **Use the [GitHub issue search][issue-search]** — Check if the issue
32 | has already been reported.
33 | 2. **Check if the issue has been fixed** — Try to reproduce the problem
34 | using the code in the `master` branch.
35 | 3. **Isolate the problem** — Try to create an
36 | [isolated js fiddle][isolated-case] that consistently reproduces the problem.
37 |
38 | Please try to be as detailed as possible in your bug report, especially if an
39 | isolated test case cannot be made. Some useful questions to include the answer
40 | to are:
41 |
42 | - What steps can be used to reproduce the issue?
43 | - What is the bug and what is the expected outcome?
44 | - What browser(s) and Operating System have you tested with?
45 | - Does the bug happen consistently across all tested browsers?
46 | - What version of jQuery are you using? And what version of bootstrap-checkbox-x?
47 | - Are you using bootstrap-checkbox-x with other plugins?
48 |
49 | All of these questions will help others fix and identify any potential bugs.
50 |
51 | Requesting features in bootstrap-checkbox-x
52 | ------------------------------------------
53 | Before starting work on a major feature for bootstrap-checkbox-x, **read the
54 | [documentation](http://plugins.krajee.com/checkbox-x) first** or you may risk spending a considerable amount of
55 | time on something which the project developers are not interested in bringing into the project.
56 |
57 | ### Submitting a pull request
58 |
59 | We use GitHub's pull request system for submitting patches. Here are some
60 | guidelines to follow when creating the pull request for your fix.
61 |
62 | 1. Make sure to create a ticket for your pull request. This will serve as the
63 | bug ticket, and any discussion about the bug will take place there. Your pull
64 | request will be focused on the specific changes that fix the bug.
65 | 2. Make sure to reference the ticket you are fixing within your pull request.
66 | This will allow us to close off the ticket once we merge the pull request, or
67 | follow up on the ticket if there are any related blocking issues.
68 | 3. Explain why the specific change was made. Not everyone who is reviewing your
69 | pull request will be familiar with the problem it is fixing.
70 | 4. Run your tests first. If your tests aren't passing, the pull request won't
71 | be able to be merged. If you're breaking existing tests, make sure that you
72 | aren't causing any breaking changes.
73 | 5. Only include source changes. While it's not required, only including changes
74 | from the `src` directory will prevent merge conflicts from occuring. Making
75 | this happen can be as a simple as not committing changes from the `dist`
76 | directory.
77 |
78 | By following these steps, you will make it easier for your pull request to be
79 | reviewed and eventually merged.
80 |
81 | Triaging issues and pull requests
82 | ---------------------------------
83 | Anyone can help the project maintainers triage issues and review pull requests.
84 |
85 | ### Handling new issues
86 |
87 | bootstrap-checkbox-x regularly receives new issues which need to be tested and organized.
88 |
89 | When a new issue that comes in that is similar to another existing issue, it
90 | should be checked to make sure it is not a duplicate. Duplicates issues should
91 | be marked by replying to the issue with "Duplicate of #[issue number]" where
92 | `[issue number]` is the url or issue number for the existing issue. This will
93 | allow the project maintainers to quickly close off additional issues and keep
94 | the discussion focused within a single issue.
95 |
96 | If you can test issues that are reported to bootstrap-checkbox-x that contain test cases and
97 | confirm under what conditions bugs happen, that will allow others to identify
98 | what causes a bug quicker.
99 |
100 | ### Reviewing pull requests
101 |
102 | It is very common for pull requests to be opened for issues that contain a clear
103 | solution to the problem. These pull requests should be rigorously reviewed by
104 | the community before being accepted. If you are not sure about a piece of
105 | submitted code, or know of a better way to do something, do not hesitate to make
106 | a comment on the pull request.
107 |
108 | ### Reviving old tickets
109 |
110 | If you come across tickets which have not been updated for a while, you are
111 | encouraged to revive them. While this can be as simple as saying `:+1:`, it is
112 | best if you can include more information on the issue. Common bugs and feature
113 | requests are more likely to be fixed, whether it is by the community or the
114 | developers, so keeping tickets up to date is encouraged.
115 |
116 | Licensing
117 | ---------
118 |
119 | It should also be made clear that **all code contributed to bootstrap-checkbox-x** must be
120 | licensable under the [BSD-3 license][licensing]. Code that cannot be released
121 | under this license **cannot be accepted** into the project.
122 |
123 | [isolated-case]: https://jsfiddle.net/
124 | [issue-search]: https://github.com/kartik-v/bootstrap-checkbox-x/search?q=&type=Issues
125 | [issue-tracker]: https://github.com/kartik-v/bootstrap-checkbox-x/issues
126 | [licensing]: https://github.com/kartik-v/bootstrap-checkbox-x/blob/master/LICENSE.md
127 | [reporting-bugs]: #reporting-bugs-with-bootstrap-checkbox-x
128 | [requesting-features]: #requesting-features-in-bootstrap-checkbox-x
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Prerequisites
2 |
3 | - [ ] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
4 | - [ ] The issue still exists against the latest `master` branch of bootstrap-checkbox-x.
5 | - [ ] This is not an usage question. I confirm having read the plugin [documentation](http://plugins.krajee.com/checkbox-x) and [demos](http://plugins.krajee.com/checkbox-x/demo).
6 | - [ ] This is not a general programming / coding question. (Those should be directed to the [webtips Q & A forum](http://webtips.krajee.com/questions)).
7 | - [ ] I have attempted to find the simplest possible steps to reproduce the issue.
8 | - [ ] I have included a failing test as a pull request (Optional).
9 |
10 | ## Steps to reproduce the issue
11 |
12 | 1.
13 | 2.
14 | 3.
15 |
16 | ## Expected behavior and actual behavior
17 |
18 | When I follow those steps, I see...
19 |
20 | I was expecting...
21 |
22 | ## Environment
23 |
24 | Browsers
25 |
26 | - [ ] Google Chrome
27 | - [ ] Mozilla Firefox
28 | - [ ] Internet Explorer
29 | - [ ] Safari
30 |
31 | Operating System
32 |
33 | - [ ] Windows
34 | - [ ] Mac OS X
35 | - [ ] Linux
36 | - [ ] Mobile
37 |
38 | Libraries
39 |
40 | - jQuery version:
41 | - bootstrap-checkbox-x version:
42 |
43 | ## Isolating the problem
44 |
45 | - [ ] This bug happens [on the plugin demos page](http://plugins.krajee.com/checkbox-x/demo)
46 | - [ ] The bug happens consistently across all tested browsers
47 | - [ ] This bug happens when using bootstrap-checkbox-x without other plugins
48 | - [ ] I can reproduce this bug in [a jsbin](https://jsbin.com/)
49 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Scope
2 | This pull request includes a
3 |
4 | - [ ] Bug fix
5 | - [ ] New feature
6 | - [ ] Translation
7 |
8 | ## Changes
9 | The following changes were made
10 |
11 | -
12 | -
13 | -
14 |
15 | ## Related Issues
16 | If this is related to an existing ticket, include a link to it as well.
--------------------------------------------------------------------------------
/.github/stale.yml:
--------------------------------------------------------------------------------
1 | # Number of days of inactivity before an issue becomes stale
2 | daysUntilStale: 60
3 | # Number of days of inactivity before a stale issue is closed
4 | daysUntilClose: 7
5 | # Issues with these labels will never be considered stale
6 | exemptLabels:
7 | - bug
8 | - enhancement
9 | - pinned
10 | - security
11 | # Label to use when marking an issue as stale
12 | staleLabel: wontfix
13 | # Comment to post when marking an issue as stale. Set to `false` to disable
14 | markComment: >
15 | This issue has been automatically marked as stale because it has not had
16 | recent activity. It will be closed if no further activity occurs. Thank you
17 | for your contributions.
18 | # Comment to post when closing a stale issue. Set to `false` to disable
19 | closeComment: false
--------------------------------------------------------------------------------
/CHANGE.md:
--------------------------------------------------------------------------------
1 | Change Log: `bootstrap-checkbox-x`
2 | ==================================
3 |
4 | ## Version 1.5.7
5 |
6 | **Date**: 19-Sep-2021
7 |
8 | - (enh #59): Allow custom icon CSS for checked, unchecked and null states.
9 | - (enh #58): New boolean property `useCrossIcon` for checked indicator.
10 | - (enh #57): Revamp bootstrap checkbox-x markup for better styling & alignment across Bootstrap versions.
11 | - New CSS class `.cbx-krajee` for the container markup to enclose all checkboxes with their labels
12 | - Automated label and input vertical alignment for checkboxes
13 | - (enh #56): Enhancements to support all bootstrap versions (5.x, 4.x. and 3.x) enhancement
14 | - (enh #55): Use enhanced SVG icons
15 |
16 | ## Version 1.5.6
17 |
18 | **Date**: 19-May-2021
19 |
20 | - Update CDN version to use jsdelivr.
21 |
22 | ## Version 1.5.5
23 |
24 | **Date**: 02-Nov-2018
25 |
26 | - Add github contribution and issue/PR log templates.
27 | - enh #53: Rename events to start with `checkbox:` instead of ending with `.checkbox` .
28 | - enh #48: Correct package.json.
29 | - enh #43: Add support for `bootstrap-sass` through new `sass` branch.
30 | - enh #42: Display initial value correctly when initializing with checkbox
31 | - enh #39: New property `allowThreeValOnInit` for showing third state on init for two state checkboxes.
32 | - enh #38, #41: Use string values instead of integers.
33 |
34 | ## Version 1.5.4
35 |
36 | **Date**: 19-Sep-2015
37 |
38 | - (enh #36): Include ability to configure themes for styling.
39 | - (enh #35): Configurable values for checked, unchecked and null.
40 | - (enh #34): Enhancements to support Select Input.
41 | - (enh #32): Implement `destroy` method.
42 | - Better bootstrap version dependency.
43 | - (enh #31): Enhance events and implement event namespace `.checkbox`.
44 | - (enh #30): Enhance validation to change checkbox states based on input type and label enclosure.
45 | - (bug #29): Trigger change correctly for threeState input within enclosed label.
46 |
47 | ## Version 1.5.3
48 |
49 | **Date**: 18-Jun-2015
50 |
51 | - (enh #24): Styling enhancements for BS contextual states.
52 | - (enh #23): Better styling to prevent block selection for checkbox container & label.
53 | - (enh #22): New configurable property `tabindex`.
54 |
55 | ## Version 1.5.2
56 |
57 | **Date**: 10-May-2015
58 |
59 | - (enh #20): Validate `click` event for iOS devices.
60 | - (enh #19): Better default markup for `iconNull`.
61 | - (enh #18): Enhancement to checkbox styles to align indicators centered perfectly.
62 | - (enh #17): Parse checkbox values correctly using integer comparison.
63 | - (enh #16): Styling enhancements for native checkbox to be compatible with Bootstrap v3.3.2+.
64 | - (bug #15): Fix init issues when checkboxX is initialized on non-checkbox input (e.g. text).
65 |
66 | ## Version 1.5.1
67 |
68 | **Date**: 31-Jan-2015
69 |
70 | - (enh #14): Implement reusable constructor for extending plugin if needed.
71 | - (enh #13): Code restructure and formatting to cleanup various lint errors (using JSHint Code cleanup library).
72 |
73 | ## Version 1.5.0
74 |
75 | **Date**: 28-Dec-2014
76 |
77 | - (enh #9, #10, #11): Fix validation of checkbox changes for plugin initialization on checkbox inputs:
78 | - Three State & Two State
79 | - Non-enclosed labels
80 | - Enclosed labels
81 | - Non-enclosed labels (native)
82 | - Enclosed labels (native)
83 |
84 | ## Version 1.4.0
85 |
86 | **Date**: 08-Nov-2014
87 |
88 | - Updated CHANGE log to reflect user friendly date time formats.
89 |
90 | ## Version 1.3.0
91 |
92 | **Date:** 16-Oct-2014
93 |
94 | - (enh #5): Add styling for labels similar to bootstrap
95 | - (enh #4): Add support for using native tristate checkboxes
96 |
97 | ## Version 1.2.0
98 |
99 | **Date:** 15-Oct-2014
100 |
101 | - (bug #3): Added `enclosedLabel` property for correct toggling of checkboxes enclosed inside labels.
102 | - Removed `labelClickEvent` property.
103 |
104 | ## Version 1.1.0
105 |
106 | **Date:** 10-Oct-2014
107 |
108 | - (enh #2): Add `labelClickEvent` property for controlling triggering change event on label click.
109 |
110 | ## Version 1.0.0
111 |
112 | **Date:** 12-Jun-2014
113 |
114 | Initial release. The following features are included in this release:
115 |
116 | - Enhances any HTML input with `data-toggle=checkbox-x` to an extended checkbox control.
117 | - The plugin offers the following three states and values for the checkboxes:
118 | - `1` or `true`: Checkbox is checked.
119 | - `0` or `false`: Checkbox is unchecked.
120 | - `null`: Checkbox is indeterminate.
121 | - You can set the plugin to allow **three states** or the default **two states** for the checkbox.
122 | - Specifically uses Bootstrap 3.x styles & glyphs. One can configure the checked, unchecked, and indeterminate icons to be shown for the checkboxes.
123 | - Special CSS 3 styling, to enhance the control to look like any Bootstrap 3 form control. Supports the `has-error`, `has-success`, `has-warning`
124 | styling states like other Bootstrap form-controls.
125 | - Plugin CSS styling automatically defaults the checkboxes to inline display. You can also control the markup for block display like in checkbox lists.
126 | - You can add a `label` before or after with a `for` attribute and click on the label to change the checkbox values. Alternatively you can enclose the
127 | input within a `label` tag as well.
128 | - Ability to navigate to the checkbox controls via keyboard, and modify the values using the `space` bar on the keyboard.
129 | - Ability to size the checkbox control. Five prebuilt size templates are available `xl`, `lg`, `md`, `sm`, and `xs`.
130 | - Triggers JQuery events for advanced development. The plugin automatically triggers the `change` event for the input, whenever the checkbox value is changed via clicking. Events currently available are `change` and `reset`.
131 | - Ability to access methods and refresh the input dynamically via javascript at runtime.
132 | - Disabled and readonly checkbox input support.
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 - 2021, Kartik Visweswaran
2 | Krajee.com
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification,
6 | are permitted provided that the following conditions are met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice, this
12 | list of conditions and the following disclaimer in the documentation and/or
13 | other materials provided with the distribution.
14 |
15 | * Neither the names of Kartik Visweswaran or Krajee nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
23 |
24 | An extended checkbox plugin for Bootstrap built using JQuery, which allows three checkbox states and includes additional styles. The plugin uses Bootstrap markup and CSS 3 styling by default, but it can be overridden with any other CSS markup. It also helps you to fallback to a native checkbox OR display native checkboxes with tristate capability.
25 |
26 | With v1.5.5, the plugin now supports initializing widget on a SELECT input as well (other than a CHECKBOX or TEXT input).
27 |
28 | > NOTE: The checkbox plugin stores the values by default as character format (and not boolean format) for checked and unchecked states. This can be overridden by setting `valueChecked`, `valueUnchecked` and `valueNull` properties.
29 |
30 | ## Features
31 |
32 | 1. Enhances any HTML input (preferrably a checkbox or text input) with `data-toggle=checkbox-x` to an extended checkbox control.
33 | 2. The plugin offers the following three states and values for the checkboxes:
34 | - `'1'`: Checkbox is checked. This value is configurable through `valueChecked` property.
35 | - `'0'`: Checkbox is unchecked. This value is configurable through `valueUnchecked` property.
36 | - `''`: Checkbox is indeterminate. This value is configurable through `valueNull` property.
37 | 3. You can set the plugin to allow **three states** or the default **two states** for the checkbox.
38 | 4. Specifically uses Bootstrap 5.x or 4.x or 3.x styles. One can configure the checked, unchecked, and indeterminate icons to be shown for the checkboxes.
39 | 5. Special CSS 3 styling, to enhance the control to look like any Bootstrap 3 form control. Supports the `has-error`, `has-success`, `has-warning`
40 | styling states like other Bootstrap form-controls.
41 | 6. Plugin CSS styling automatically defaults the checkboxes to inline display. You can also control the markup for block display like in checkbox lists.
42 | 7. You can add a `label` before or after with a `for` attribute and click on the label to change the checkbox values. Alternatively you can enclose the
43 | input within a `label` tag as well.
44 | 8. Ability to navigate to the checkbox controls via keyboard, and modify the values using the `space` bar on the keyboard.
45 | 9. Ability to size the checkbox control. Five prebuilt size templates are available `xl`, `lg`, `md`, `sm`, and `xs`.
46 | 10. Triggers JQuery events for advanced development. The plugin automatically triggers the `change` event for the input, whenever the checkbox value is changed via clicking. Events currently available are `change` and `checkbox.reset`.
47 | 11. Ability to access methods and refresh the input dynamically via javascript at runtime.
48 | 12. Disabled and readonly checkbox input support.
49 | 13. Allow third state to be configured (only on init) for two state checkboxes.
50 | 14. Added support for displaying native checkboxes with tristate capability. When displaying native checkboxes, the advanced styling offerred by the plugin will not be available.
51 |
52 | > NOTE: The latest version of the plugin v1.5.7 has been released. Refer the [CHANGE LOG](https://github.com/kartik-v/bootstrap-checkbox-x/blob/master/CHANGE.md) for details.
53 |
54 | ## Documentation and Demo
55 |
56 | View the [plugin documentation](http://plugins.krajee.com/checkbox-x) and [plugin demos](http://plugins.krajee.com/checkbox-x/demo) at Krajee JQuery plugins.
57 |
58 | ## Pre-requisites
59 |
60 | 1. [Bootstrap 5.x or 4.x or 3.x](http://getbootstrap.com/)
61 | 2. Latest [JQuery](http://jquery.com/)
62 | 3. Most browsers supporting CSS3 & JQuery.
63 |
64 | > NOTE: You can use the sass branch for installation using bootstrap-sass dependency. The master branch can be used for installation using the default official bootstrap dependency.
65 |
66 | ## Installation
67 |
68 | ### Using Bower
69 | You can use the `bower` package manager to install. Run:
70 |
71 | bower install bootstrap-checkbox-x
72 |
73 | ### Using Composer
74 | You can use the `composer` package manager to install. Either run:
75 |
76 | $ php composer.phar require kartik-v/bootstrap-checkbox-x "@dev"
77 |
78 | or add:
79 |
80 | "kartik-v/bootstrap-checkbox-x": "@dev"
81 |
82 | to your composer.json file
83 |
84 | ### Manual Install
85 |
86 | You can also manually install the plugin easily to your project. Just download the source [ZIP](https://github.com/kartik-v/bootstrap-checkbox-x/zipball/master) or [TAR ball](https://github.com/kartik-v/bootstrap-checkbox-x/tarball/master) and extract the plugin assets (css and js folders) into your project.
87 |
88 | ## Usage
89 |
90 | Step 1: Load the following assets in your header.
91 |
92 | ```html
93 |
94 |
95 |
96 |
97 |
98 |
99 | ```
100 |
101 | If you noticed, you need to load the `jquery.min.js` and `bootstrap.min.css` in addition to the `checkbox-x.min.css` and `checkbox-x.min.js` for
102 | the plugin to work with default settings. Loading the theme file `theme-krajee-flatblue.min.css` is optional and is needed if you want to override the default theme. Read the `theme` property of the plugin for understanding configuration details for themes.
103 |
104 | Step 2: Setup your input markup with `data-toggle="checkbox-x"` to automatically initialize the checkbox control
105 | ```html
106 |
107 | ```
108 |
109 | Step 3: You can also initialize the plugin on your page using javascript as well, instead of using `data-toggle` attribute as above. For example,
110 |
111 | ```html
112 |
114 |
115 |