<!-- Default -->
<label class="checkbox checkbox--primary">
    <input type="checkbox" name="primary">

    <span class="label">First name</span>

    <span class="checkmark-container">
        <span class="checkmark"></span>
    </span>
</label>

<!-- Secondary -->
<label class="checkbox checkbox--secondary">
    <input type="checkbox" name="secondary">

    <span class="label">Secondary First name</span>

    <span class="checkmark-container">
        <span class="checkmark"></span>
    </span>
</label>

<!-- With Dob -->
<label class="checkbox checkbox--with-dob">
    <input type="checkbox" name="with-dob">
    <div class="dob-label-container">
        <span class="label">with dob</span>
        <p class="dob-label">DOB: 10/10/2010</p>
    </div>
    <span class="checkmark-container">
        <span class="checkmark"></span>
    </span>
</label>

No notes defined.

/* Default */
{
  "copy": "First name",
  "modifier": "primary",
  "id": "primary",
  "name": "primary"
}

/* Secondary */
{
  "copy": "Secondary First name",
  "modifier": "secondary",
  "id": "secondary",
  "name": "secondary"
}

/* With Dob */
{
  "copy": "with dob",
  "modifier": "with-dob",
  "id": "with-dob",
  "name": "with-dob",
  "dob": "DOB: 10/10/2010"
}

  • Content:
    .checkbox {
      display: flex;
      position: relative;
      cursor: pointer;
      -webkit-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
      // background-color: $crest-blue;
      line-height: 26px;
    
      &:not(:first-child) {
        margin-top: 16px;
      }
    
      .dob-label,
      .label {
        left: 50px;
        color: white;
        font-family: $registration-font;
        font-weight: 400;
        font-size: 16px;
        line-height: 26px;
        margin-left: 41px;
    
        a {
          color: white;
    
          &:hover {
            font-weight: 700;
          }
    
          &:focus-visible {
            background-color: $yellow1;
            border-bottom: 1px solid $black1;
            outline: none;
            text-decoration: none;
            color: $black1;
          }
        }
      }
    
      /* Create a custom checkbox */
      .checkmark-container {
        border: 1px solid white;
        border-radius: 2px;
        height: 25px;
        width: 25px;
        position: absolute;
        top: auto;
        left: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    
        .checkmark {
          border-radius: 2px;
          height: 19px;
          width: 19px;
        }
      }
    
      /* Create the checkmark/indicator (hidden when not checked) */
      .checkmark::after {
        content: '';
        display: none;
        position: absolute;
        left: 8px;
        top: 4px;
        width: 7px;
        height: 13px;
        border: solid $crest-blue;
        border-width: 0 2px 2px 0;
        -webkit-transform: rotate(45deg);
        -ms-transform: rotate(45deg);
        transform: rotate(45deg);
      }
    
      &--with-dob {
        align-items: center;
    
        .dob-label-container {
          margin: 6px 8px 6px 50px;
        }
    
        .dob-label,
        .label {
          display: block;
          margin-left: 0;
          font-size: 16px;
          line-height: 16px;
        }
    
        .dob-label {
          font-weight: 400;
          line-height: 14px;
          margin-top: 5px;
          font-size: 14px;
        }
      }
    
      &--primary {
        padding: 9px 16px 9px 0;
        align-items: baseline;
      }
    
      &--with-dob,
      &--primary {
        border: 1px solid white;
        border-radius: 2px;
    
        input {
          margin: 9px inherit 9px 9px;
        }
    
        .checkmark-container {
          margin-left: 9px;
        }
    
        &:has(input:checked) {
          background-color: white;
          .dob-label,
          .label {
            color: $crest-blue;
          }
    
          .checkmark-container {
            border-color: $crest-blue;
          }
        }
    
        &:hover,
        &:has(input:checked):hover {
          background-color: $rj-blue;
        }
    
        &:has(input:checked):hover {
          .dob-label,
          .label {
            color: white;
          }
    
          .checkmark {
            background-color: white;
          }
        }
    
        input:checked ~ .checkmark-container {
          background-color: white;
    
          .checkmark {
            background-color: $crest-blue;
          }
        }
    
        @media screen and (max-width: $mq-medium) {
          &:has(input:checked):hover {
            background-color: white;
    
            .dob-label,
            .label {
              color: $crest-blue;
            }
    
            .checkmark-container {
              border-color: $crest-blue;
            }
          }
        }
      }
    
      /* Style the checkmark/indicator */
      &--secondary {
        align-items: baseline;
    
        &:hover input ~ .checkmark-container {
          background-color: $rj-blue;
        }
    
        /* When the checkbox is checked, add a blue background */
        input:checked ~ .checkmark-container {
          background-color: $crest-blue;
    
          .checkmark {
            background-color: white;
          }
        }
      }
    
      input {
        position: absolute;
        opacity: 0;
        cursor: pointer;
        height: 0;
        width: 0;
    
        &:checked ~ .checkmark-container .checkmark::after {
          display: block;
        }
    
        &:focus-visible ~ .checkmark-container {
          outline: none;
          background-color: $yellow1;
          border: 1px solid $black1;
        }
    
        &:checked:focus-visible ~ .checkmark-container {
          outline: none;
          background-color: $yellow1;
          border: 1px solid $black1;
    
          .checkmark {
            background-color: $yellow1;
          }
    
          .checkmark::after {
            border-color: $black1;
          }
        }
      }
    }
    
  • URL: /components/raw/checkbox/checkbox.scss
  • Filesystem Path: src/library/components/checkbox/checkbox.scss
  • Size: 4 KB
<label class="checkbox checkbox--{{modifier}}">
  <input type="checkbox" {{#if fan}}data-fan="{{fan}}" {{/if}} {{#if value}} value="{{value}}" {{/if}} {{#if
    name}}name="{{name}}" {{/if}} {{#if username}}data-name="{{username}}" {{/if}} {{#if
    individualId}}data-individual-id="{{individualId}}" {{/if}}>
  {{#if dob}}<div class="dob-label-container">{{/if}}
    <span class="label">{{copy}}</span>
    {{#if dob}}<p class="dob-label">{{dob}}</p>{{/if}}
    {{#if dob}}
  </div>{{/if}}
  <span class="checkmark-container">
    <span class="checkmark"></span>
  </span>
</label>