<div class="checkbox checkbox--default"><input class="checkbox__input" id="checkbox-|***37f36e***|" type="checkbox" name="checkbox-name" /><label class="checkbox__label" for="checkbox-|***37f36e***|">Checkbox</label></div>
- checkboxId = id || `checkbox-|***${randomString()}***|`;
#{tag || 'div'}.checkbox(
  class=classNames(`checkbox--${style || 'default'}`),
)&attributes(attr)
  input.checkbox__input(
    id=checkboxId,
    type='checkbox',
    name=name,
    value=value,
    checked=checked,
    required=required,
    disabled=disabled,
    aria-invalid=invalid && 'true',
    aria-describedby=descriptionId,
    aria-labelledby=labelId,
    aria-errormessage=errorId,
  )&attributes(attrCheckbox)
  if label
    label.checkbox__label(for=checkboxId) !{render(label, true)}
{
  "name": "checkbox-name",
  "label": "Checkbox"
}
  • Content:
    .checkbox {
      $size: 1.2em;
    
      cursor: pointer;
      display: inline-block;
      font-size: $form-font-size;
      user-select: none;
      vertical-align: middle;
    
      input {
        opacity: 0;
        position: absolute;
      }
    
      input,
      label {
        cursor: pointer;
      }
    
      input:disabled,
      input:disabled + label {
        color: $color-gray;
        cursor: default;
      }
    
      input + label::before {
        background: transparent;
        border: 1px solid $color-gray;
        content: '';
        display: inline-block;
        height: $size;
        margin-right: $size * 0.5;
        margin-top: -($size * 0.2);
        vertical-align: middle;
        width: $size;
      }
    
      input:checked + label::before {
        background: url('../images/backgrounds/bg-checkbox-white.png') no-repeat center center $color-green;
        background-size: 12px auto;
        border: 1px solid $color-green;
      }
    
      input:disabled + label::before {
        border: 1px solid $color-gray;
      }
    
      input:checked:disabled + label::before {
        background: url('../images/backgrounds/bg-checkbox-white.png') no-repeat center center $color-gray;
        background-size: 12px auto;
        border: 1px solid $color-gray;
      }
    
      a {
        border-bottom: 1px solid currentColor;
        color: $color-green;
    
        @media(hover: hover) and (pointer: fine) {
          &:hover {
            color: $color-gray;
          }
        }
      }
    }
    
  • URL: /components/raw/checkbox/checkbox.scss
  • Filesystem Path: src/components/atoms/checkbox/checkbox.scss
  • Size: 1.3 KB

There are no notes for this item.