Skip to content

About

Native checkboxes and radio buttons styled with CSS. Compatible with Bootstrap 3, 4, 5 and standalone forms.

Topics

Resources

Stars

2.0k stars

Watchers

98 watching

Forks

Repository files navigation

Awesome Bootstrap Checkbox

Style native checkboxes and radio buttons with a single stylesheet. Use it with Bootstrap 3, 4 or 5, or drop it into a standalone form. Keyboard controls, form submission and browser validation use the native HTML inputs.

Try the playground · Download the stylesheet · Changelog

Interactive checkbox and radio examples with a configurable notification form

Quick start

Download the stylesheet above and place it after your Bootstrap CSS, if you use Bootstrap.

<link rel="stylesheet" href="./awesome-bootstrap-checkbox.css">

<div class="abc-checkbox">
  <input type="checkbox" id="updates" name="updates" checked>
  <label for="updates">Product updates</label>
</div>

For a bundled application, install the npm package from the GitHub release and import the stylesheet in your entry file.

npm install https://github.com/flatlogic/awesome-bootstrap-checkbox/releases/download/v3.0.0/awesome-bootstrap-checkbox-3.0.0.tgz
import 'awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css';

Radios and mixed selections

Give related radios the same name and wrap the group in a fieldset. Arrow keys move between choices. Space toggles a focused checkbox.

<fieldset>
  <legend>Delivery</legend>
  <div class="abc-radio">
    <input type="radio" id="standard" name="delivery" value="standard" checked>
    <label for="standard">Standard</label>
  </div>
  <div class="abc-radio">
    <input type="radio" id="express" name="delivery" value="express">
    <label for="express">Express</label>
  </div>
</fieldset>

Use the native disabled attribute to disable a control or an entire fieldset. Set the DOM property input.indeterminate = true on a checkbox to show a partial selection. The playground includes a working “All files” example. For an input without visible label text, supply an accessible name with aria-label or aria-labelledby.

Appearance

To get Add to the wrapper
A round checkbox abc-checkbox-circle
Inline controls abc-checkbox-inline or abc-radio-inline
Bootstrap color variants abc-checkbox-success, abc-radio-danger, or the corresponding primary, info and warning variants

CSS custom properties can be scoped to one form.

.preferences {
  --abc-accent: #21644e;
  --abc-focus: #2456c3;
  --abc-size: 1.25em;
  --abc-radius: 0.3em;
}

The default checkmark is drawn in CSS. The controls respect reduced-motion preferences and use system control rendering in forced-colors mode.

Upgrading an existing project

  • Bootstrap 3 wrappers .checkbox and .radio and Bootstrap 4/5 wrappers .abc-checkbox and .abc-radio remain supported. Existing .form-check-input and .form-check-label classes can stay in place.
  • The CSS, Sass and Less entry filenames are unchanged. Custom themes can continue configuring $check-icon and $font-family-icon in Sass, or @check-icon and @font-family-icon in Less. Supply the corresponding font when using a custom glyph.
  • Version 3 draws the control on the native input. Themes that previously positioned label::before or label::after should use the wrapper properties above. Direct file copies of the Sass or Less source also need the accompanying styles/controls.css.
  • The browser target is current Chromium, Firefox and Safari. The controls were tested with Bootstrap CSS 3.3.2, 3.4.1, 4.6.2 and 5.3.9.

Development

Use Node.js 22 or 24. From a clean checkout, run:

npm ci
npm run build
npx playwright install chromium
npm test

Open demo/index.html to try the examples offline. The demo includes its fonts and styles. Its JavaScript handles the accent picker, tabs, clipboard and mixed-selection example. The library itself has no JavaScript or runtime package dependencies.

License

MIT. Originally inspired by Bootstrap and Font Awesome. The demo fonts include their Open Font Licenses.

About

Native checkboxes and radio buttons styled with CSS. Compatible with Bootstrap 3, 4, 5 and standalone forms.

Topics

Resources

Stars

2.0k stars

Watchers

98 watching

Forks

Releases

Packages

Used by

Contributors

Languages