0.0.3

Checkbox

A pure vanilla JS implementation of Zag JS Checkbox Opens in a new window


Anatomy

The Checkbox component consists of the following data-part

root label hidden-input control

To hide and show the correct on checkobx states, you must add class="control__checked" and class="control__indeterminate" to the respective icons

<div class="checkbox checkbox-js">
                  <label data-part="root">
                  <span data-part="label">Label</span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>

Data attributes

Each checkbox can be set with different settings with the following data-attribute.

We are aware of a bug regarding the default state as indeterminate. It currently sets the state as true instead of "indeterminate". We will update the components as soon as it is resolved on the new version.

<div>
                  <div class="checkbox checkbox-js" data-default-checked="true">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js" data-checked="indeterminate">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js" data-default-checked="true" data-disabled="true">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js" data-invalid="true">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js" data-default-checked="true" data-invalid="true">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  </div>
Data attribute Type / Options Description
id string The unique id of the component. Default generated if none is provided
data-default-checked boolean || "indeterminate The initial checked state of the checkbox
data-checked boolean || "indeterminate The controlled checked state of the checkbox
data-dir ltr | rtl The orientation of the checkbox. Can be `ltr` or `rtl`
data-disabled string Whether the checkbox is disabled
data-invalid boolean Whether the checkbox is invalid
data-required boolean Whether the checkbox is required
data-read-only boolean Whether the checkbox is read only
data-form string The id of the form that the checkbox belongs to.
data-name string The name of the input field in a checkbox. Useful for form submission.
data-value string The value of checkbox input. Useful for form submission. Default to "on"

Callbacks

Each checkbox component can receive callbacks that can be used to respond to user interaction with custom behavior.

You must add a custom id and an event listener for your event name


                  document.getElementById("my-callback-checkbox")
                  ?.addEventListener("my-callback-checkbox-event", (event) => {
                    console.log("Received event:", (event as CustomEvent).detail);
                  });
              
<div id="my-callback-checkbox" class="checkbox checkbox-js" data-on-checked-change="my-callback-checkbox-event">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>

Open your browser's console to see the events received when you open or close the above checkbox

Data attribute Type / Options Description
data-on-open-change string Function to call when the checkbox's open state changes

Checked State Control

Checkbox checked state can be control with data attributes on any element

You must set a custom id for your checkbox, as the default is randomly generated

data-check-checkbox="checkbox-id" data-uncheck-checkbox="checkbox-id" data-indeterminate-checkbox="checkbox-id"
<div>
                  <button data-check-checkbox="my-checkbox" class="button button--sm">
                  Check Checkbox
                  </button>
                  <button data-uncheck-checkbox="my-checkbox" class="button button--sm">
                  Uncheck Checkbox
                  </button>
                  </div>
                  <div id="my-checkbox" class="checkbox checkbox-js">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>

You also dispatch an event named checkbox:set-checked to the checkbox id with a boolean value


                  const el = document.getElementById("my-checkbox");
                  if (el) {
                    el.dispatchEvent(
                      new CustomEvent("checkbox:set-checked", {
                        detail: { value: true },
                      })
                    );
                  } else {
                    console.warn("Element with ID 'my-checkbox' not found");
                  }
              

Use with Form

Checkbox can be used inside a form

You must set the id of the form and the name of the checkbox

data-form="form-id" data-name="checkbox-name"

You can also add the value of the checkbox. Default to : "on"

data-value="yes"
<form id="my-form">
                  <div class="checkbox checkbox-js" data-form="my-form" data-name="newsletter" data-value="yes">
                  <label data-part="root">
                  <span data-part="label">Receive Newsletter ?</span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <button class="button button--accent" type="submit">Submit</button>
                  </form>
                  <div id="result"></div>

You can use the results from the form as you wish


                const form = document.getElementById('my-form') as HTMLFormElement | null;
                const result = document.getElementById('result') as HTMLDivElement | null;
                
                if (form && result) {
                  form.addEventListener('submit', (e: Event) => {
                    e.preventDefault();
                    const formData = new FormData(form);
                    const newsletter = (formData.get('newsletter') as string) || 'no';
                    result.textContent = `Submitted: newsletter: ${newsletter}`;
                  });
                }
              

Modifier

Each checkbox can be styled with modifiers.

You can mix as many modifiers on the same checkbox, however you can choose only one choice per modifer

For convenience the default variant name is omited, meaning there is no need to add the default name class

You may have noticed the double dash before the modifier name — this follows the BEM (Block Element Modifier) Opens in a new window naming convention
Modifier Option Description
Color base (default), brand, alert Use any semantic colors
Size md (default), sm, lg, xl Modify the size of the checkbox.
Shape square (default), circle Modify the shape of the checkbox.

Color

Set the color of each button

Options: base(default), brand, alert

<div>
                  <div class="checkbox checkbox-js">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--brand">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--alert">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  </div>

Size

Set the size of each button

Options: md(default), sm, lg, xl

<div>
                  <div class="checkbox checkbox-js checkbox--sm">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--lg">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--xl">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  </div>

Shape

Set the shape of each button

Options: square(default), circle

<div>
                  <button class="button button--square" aria-label="button button--square">
                  <svg class="button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"></path>
                  </svg>
                  </button>
                  <button class="button button--square" aria-label="button button--square">B</button>
                  <button class="button button--circle" aria-label="Button circle">
                  <svg class="button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"></path>
                  </svg>
                  </button>
                  <button class="button button--circle" aria-label="Button circle">B</button>
                  </div>
                  <div>
                  <button class="button button--square button--accent" aria-label="button button--square">
                  <svg class="button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"></path>
                  </svg>
                  </button>
                  <button class="button button--square button--accent" aria-label="button button--square">B</button>
                  <button class="button button--circle button--accent" aria-label="Button circle">
                  <svg class="button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"></path>
                  </svg>
                  </button>
                  <button class="button button--circle button--accent" aria-label="Button circle">B</button>
                  </div>
                  <div>
                  <button class="button button--square button--brand" aria-label="button button--square">
                  <svg class="button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"></path>
                  </svg>
                  </button>
                  <button class="button button--circle button--brand" aria-label="Button circle">B</button>
                  <button class="button button--square button--accent button--brand" aria-label="button button--square">B</button>
                  <button class="button button--circle button--accent button--brand" aria-label="Button circle">B</button>
                  </div>

Mix

Mix as many modifiers for each button

<div>
                  <div class="checkbox checkbox-js checkbox--sm checkbox--circle">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--brand checkbox--sm checkbox--circle">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--alert checkbox--sm checkbox--circle">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js  checkbox--sm">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--alert  checkbox--sm">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--brand checkbox--sm">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  </div>
                  <div>
                  <div class="checkbox checkbox-js checkbox--lg checkbox--circle">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--brand checkbox--lg checkbox--circle">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--alert checkbox--lg checkbox--circle">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js  checkbox--lg">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--alert  checkbox--lg">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  <div class="checkbox checkbox-js checkbox--brand checkbox--lg">
                  <label data-part="root">
                  <span data-part="label"></span>
                  <input data-part="hidden-input">
                  <div data-part="control">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>
                  </div>

Custom (Tailwind)

If you are using Tailwind styling, you can customize each checkbox with Tailwind utilities

<div class="checkbox checkbox-js">
                  <label data-part="root">
                  <span data-part="label" class="text-contrast-brand-2">Label</span>
                  <input data-part="hidden-input">
                  <div data-part="control" class="rounded-lg text-accent-contrast-alert  border-contrast-alert border-2 ">
                  <svg class="control__checked" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5"></path>
                  </svg>
                  <svg class="control__indeterminate" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14"></path>
                  </svg>
                  </div>
                  </label>
                  </div>

Templates

Checkbox components is available in the followng templates

Button Clipboard