<div class="form-item">
<legend class="form-item__legend">Checkboxes</legend>
<div class="checkbox__item ">
<label class="checkbox__label " for="checkbox-1">
<input class="checkbox__input " type="checkbox" name="checkboxes" id="checkbox-1" value="checkbox-1" disabled>
<span class="checkbox__title">Checkbox 1</span>
</label>
</div>
</div>
<div class="form-item">
{{#if legend}}
<legend class="form-item__legend">{{ legend }}</legend>
{{/if}}
{{#if tooltip}}
<div class="js-tooltip">
{{render "@tooltip" this}}
{{/if}}
<div class="checkbox__item {{getmodifiers modifiers "checkbox__item"}}">
<label class="checkbox__label {{ additionalClasses }}" for="{{value}}">
<input class="checkbox__input {{ additionalClasses }}" type="{{type}}" name="{{name}}" id="{{value}}" value="{{value}}" {{#if checked}}checked{{/if}} {{{ getattributes attr }}}{{#if disabled}} disabled{{/if}} >
<span class="checkbox__title">{{label}}</span>
</label>
</div>
{{#if tooltip}}
</div>
{{/if}}
{{#if errorMsg}}
<div class="form-item__error-msg">{{errorMsg}}</div>
{{/if}}
</div>
{
"legend": "Checkboxes",
"name": "checkboxes",
"label": "Checkbox 1",
"value": "checkbox-1",
"type": "checkbox",
"description": "Checkbox description",
"disabled": true,
"checked": false
}
%checkbox__label {
display: block;
position: relative;
padding-left: size(4);
color: $color-label;
line-height: size(3);
&:hover {
color: $color-input-selected;
cursor: pointer;
}
> span:before {
content: '';
position: absolute;
top: 0;
left: 0;
display: inline-block;
height: size(3);
width: size(3);
border: 1px solid $color-input-border;
background-color: $color-input-background;
background-position: center center;
background-size: size(1.5);
background-repeat: no-repeat;
// Makes lable center aligned with input field
margin-top: -2px;
}
input {
position: absolute;
height: size(3);
width: size(3);
top: 0;
left: 0;
opacity: 0;
}
input:checked ~ span {
color: $color-input-selected;
border-color: $color-input-selected;
@include color-theme {
color: $arg-theme-color;
}
&:before {
background-color: $color-input-selected;
background-image: url('x.svg');
@include color-theme {
background-color: $arg-theme-color;
}
}
}
input:focus-visible ~ span {
color: $color-input-selected;
&:before {
border-width: 2px;
border-color: $color-black;
}
}
input[aria-invalid='true']:not(:checked) ~ span, input.error {
color: $color-error;
&:before {
border-color: $color-input-border-error;
}
}
input:disabled + & {
color: $color-input-color-disabled;
&:before {
border-color: $color-input-border-disabled;
background-color: $color-input-background-disabled;
}
}
}
%simple-checkbox__label {
display: inline-block;
vertical-align: top;
padding-right: size(5);
padding-left: 0;
line-height: size(4);
font-weight: 400;
> span:before {
content: '';
top: 50%;
transform: translateY(-50%);
right: 0;
left: auto;
background-color: inherit;
border: none;
}
input {
top: 2px;
right: 0;
left: auto;
}
input:checked ~ span {
font-weight: 700;
&:before {
background-image: url('close.svg');
background-color: inherit;
}
}
}
.checkbox__label {
@extend %checkbox__label;
.checkbox__item--simple & {
@extend %simple-checkbox__label;
}
}
<symbol id="icon-cross" viewBox="0 0 30 30">
<path d="M22.2,21.1c0.4,0.4,0.4,1.1,0,1.6c0,0,0,0,0,0C22,22.9,21.7,23,21.4,23c-0.3,0-0.6-0.1-0.8-0.3L15,16.6
l-5.7,6.1C9.1,22.9,8.9,23,8.6,23c-0.3,0-0.6-0.1-0.8-0.3c-0.4-0.4-0.4-1.1,0-1.6c0,0,0,0,0,0l5.7-6.1L7.8,8.9
c-0.4-0.4-0.4-1.1,0-1.6c0,0,0,0,0,0c0.4-0.4,1-0.5,1.5,0c0,0,0,0,0,0l5.7,6.1l5.7-6.1c0.4-0.4,1-0.5,1.5,0c0,0,0,0,0,0
c0.4,0.4,0.4,1.1,0,1.6c0,0,0,0,0,0L16.5,15C16.5,15,22.2,21.1,22.2,21.1z"/>
</symbol>
<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.77675 8.2511L6.8069 5.28125L9.77675 2.3114L8.2494 0.784051L5.27955 3.7539L2.3097 0.784051L0.782348 2.3114L3.7522 5.28125L0.782348 8.2511L2.3097 9.77845L5.27955 6.8086L8.2494 9.77845L9.77675 8.2511Z" fill="#434343"/>
</svg>
<svg width="10" height="10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path d="M12.467 11.533a.644.644 0 0 1 0 .934.605.605 0 0 1-.467.2.605.605 0 0 1-.467-.2L8 8.933l-3.533 3.534a.605.605 0 0 1-.467.2.605.605 0 0 1-.467-.2.644.644 0 0 1 0-.934L7.067 8 3.533 4.467a.644.644 0 0 1 0-.934.644.644 0 0 1 .934 0L8 7.067l3.533-3.534a.644.644 0 0 1 .934 0 .644.644 0 0 1 0 .934L8.933 8l3.534 3.533z" id="a"/></defs><use fill="#FFF" xlink:href="#a" transform="translate(-3 -3)" fill-rule="evenodd"/></svg>
No notes defined.