flatlogic/awesome-bootstrap-checkbox
À propos
Cases à cocher et boutons radio natifs avec styles CSS. Compatible avec Bootstrap 3, 4 et 5, ainsi qu’avec les formulaires autonomes.
Développement web et applicatifProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- +2
- in 15 days
- 0
- in 1 month
- 0
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalAwesome 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
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
.checkboxand.radioand Bootstrap 4/5 wrappers.abc-checkboxand.abc-radioremain supported. Existing.form-check-inputand.form-check-labelclasses can stay in place. - The CSS, Sass and Less entry filenames are unchanged. Custom themes can continue configuring
$check-iconand$font-family-iconin Sass, or@check-iconand@font-family-iconin Less. Supply the corresponding font when using a custom glyph. - Version 3 draws the control on the native input. Themes that previously positioned
label::beforeorlabel::aftershould use the wrapper properties above. Direct file copies of the Sass or Less source also need the accompanyingstyles/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.
Explorer des projets similaires
Chargement…
