Skip to content

Patch to work with bootstrap 5. #237

@jck1961

Description

@jck1961

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch bootstrap-toggle@2.2.2 for the project I'm working on.

Unchecked items were not correctly colored and the little button to change the state was not visible, using bootstrap 5.3.8.

Here is the diff that solved my problem:

index 533914e..5909dbb 100644
--- a/node_modules/bootstrap-toggle/js/bootstrap-toggle.js
+++ b/node_modules/bootstrap-toggle/js/bootstrap-toggle.js
@@ -25,7 +25,7 @@
 		on: 'On',
 		off: 'Off',
 		onstyle: 'primary',
-		offstyle: 'default',
+		offstyle: 'secondary',
 		size: 'normal',
 		style: '',
 		width: null,
@@ -56,7 +56,7 @@
 			.addClass(this._onstyle + ' ' + size)
 		var $toggleOff = $('<label class="btn">').html(this.options.off)
 			.addClass(this._offstyle + ' ' + size + ' active')
-		var $toggleHandle = $('<span class="toggle-handle btn btn-default">')
+		var $toggleHandle = $('<span class="toggle-handle btn btn-light">')
 			.addClass(size)
 		var $toggleGroup = $('<div class="toggle-group">')
 			.append($toggleOn, $toggleOff, $toggleHandle)

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions