Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

Is a tristate checkbox available?


Hi!

I'm using the metronic template. I need a tristate "switch" or checkbox to represeent "true", "false", and null.

Is there anything like it in the Metronic portfolio of controls? I checked the documentation and I have not seen it.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hi,

May I know which Metronic version are you using? Please consider using the latest Metronic v8.1.7 and we can provide you a custom code to implement indeterminate state as shown in the Bootstrap docs. This fix will be added to the next update of Metronic - v8.1.8.

To make implement indeterminate in Metronic v8.1.7:

1) In src/sass/components/_variables.scss set the checkbox indeterminate variables as below:


$form-check-input-indeterminate-color: $component-checked-color !default;
$form-check-input-indeterminate-bg-color: $component-checked-bg !default;
$form-check-input-indeterminate-border-color: $component-checked-bg !default;


2) In src/sass/components/forms/_form-check.scss change the checkbox solid state code as below:


// Solid
&.form-check-solid {
.form-check-input {
border: 0;

&:not(:checked):not(:indeterminate) {
background-color: $form-check-input-bg-solid;
}
}
}


3) Use the below code to set indeterminate. Please note that an indeterminate state can be set programmatically, no HTML attribute is available for it.


document.querySelector("#kt_check_indeterminate_1").indeterminate = true;


4) Then recompile your assets folder with Gulp or Webpack.

Please note that the build tools are required only in the development environment just to compile the assets when the source folder files are modified. In the hosting/server deployment, you will only need the compile assets, no need to install the build tools dependencies there.

Regards.



that worked great! thank you very much



Hi happy,

Glad to help you out and thank you for the heads up on this. We helped us to improve Metronic with this new option.

Regards.


Your Support Matters!

We will highly appreciate your Metronic Review on Themeforest.
Please go to Themeforest Downloads page, select Metronic & leave your feedback.
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(