<div class="radio
">
<input type="radio" id="radio1" name="radio" value="" class="radio__input">
<label for="radio1" class="radio__label">
<span class="radio__indicator"></span>
<span class="radio__text">Radio label</span>
</label>
</div>
{% set BEM -%}
radio
{% if modifier %} {{ modifier }}{% endif %}
{%- if class %} {{ class }}{% endif %}
{%- if data.isDisabled %} is-disabled{% endif %}
{% endset %}
<div class="{{ BEM }}">
<input
type="radio"
id="{{ data.id }}"
name="{{ data.name }}"
value="{{ data.value }}"
class="radio__input"
{% if data.isChecked %} checked{% endif %}
{% if data.isDisabled %} disabled{% endif %}
{{ data.attributes }}
>
<label for="{{ data.id }}" class="radio__label">
<span class="radio__indicator"></span>
<span class="radio__text">{{ data.label }}</span>
</label>
{% if data.otherChoiceField %}
{% include '@textfield' with { modifier: '', class: 'choice-group__item', data: data.otherChoiceField } %}
{% endif %}
</div>
{
"language": "en-US",
"data": {
"label": "Radio label",
"id": "radio1",
"name": "radio"
}
}
.radio {
position: relative;
}
.radio__input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.radio__label {
display: inline-block;
padding-left: 28px;
.radio__input:disabled ~ & {
opacity: .3;
cursor: not-allowed; /* stylelint-disable-line plugin/no-unsupported-browser-features */
}
html[data-whatinput='keyboard'] .radio__input:focus ~ & {
outline-style: auto;
}
}
.radio__text {
font-size: $font-size-base;
font-weight: $font-weight-regular;
color: $L-text-black;
.radio__input:not(:disabled):not(:checked) + .radio__label:hover & {
color: $L-text-hover;
}
}
.radio__indicator {
display: block;
border: 2px solid $L-text;
width: 18px;
height: 18px;
border-radius: $border-radius-round;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
&:before {
content: '';
display: block;
width: 8px;
height: 8px;
background: $L-background;
border-radius: $border-radius-round;
position: absolute;
top: 50%;
transform: translateY(-50%) translateX(-50%);
left: 50%;
opacity: 0;
}
.radio__input:not(:disabled):not(:checked) + .radio__label:hover & {
background-color: $L-background-hover;
border-color: $L-border-strong-hover;
}
.radio__input:checked + .radio__label & {
background-color: $L-background-strong;
color: $L-text-weak;
border-color: $L-background-strong;
&:before {
opacity: 1;
}
}
.radio--blue & {
border: 2px solid $L-border-strong;
}
}
import './radio.scss';
<div class="radio
is-disabled">
<input type="radio" id="radio1" name="radio" value="" class="radio__input" disabled>
<label for="radio1" class="radio__label">
<span class="radio__indicator"></span>
<span class="radio__text">Radio label</span>
</label>
</div>
{% set BEM -%}
radio
{% if modifier %} {{ modifier }}{% endif %}
{%- if class %} {{ class }}{% endif %}
{%- if data.isDisabled %} is-disabled{% endif %}
{% endset %}
<div class="{{ BEM }}">
<input
type="radio"
id="{{ data.id }}"
name="{{ data.name }}"
value="{{ data.value }}"
class="radio__input"
{% if data.isChecked %} checked{% endif %}
{% if data.isDisabled %} disabled{% endif %}
{{ data.attributes }}
>
<label for="{{ data.id }}" class="radio__label">
<span class="radio__indicator"></span>
<span class="radio__text">{{ data.label }}</span>
</label>
{% if data.otherChoiceField %}
{% include '@textfield' with { modifier: '', class: 'choice-group__item', data: data.otherChoiceField } %}
{% endif %}
</div>
{
"language": "en-US",
"data": {
"label": "Radio label",
"id": "radio1",
"name": "radio",
"isDisabled": true
}
}
.radio {
position: relative;
}
.radio__input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.radio__label {
display: inline-block;
padding-left: 28px;
.radio__input:disabled ~ & {
opacity: .3;
cursor: not-allowed; /* stylelint-disable-line plugin/no-unsupported-browser-features */
}
html[data-whatinput='keyboard'] .radio__input:focus ~ & {
outline-style: auto;
}
}
.radio__text {
font-size: $font-size-base;
font-weight: $font-weight-regular;
color: $L-text-black;
.radio__input:not(:disabled):not(:checked) + .radio__label:hover & {
color: $L-text-hover;
}
}
.radio__indicator {
display: block;
border: 2px solid $L-text;
width: 18px;
height: 18px;
border-radius: $border-radius-round;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
&:before {
content: '';
display: block;
width: 8px;
height: 8px;
background: $L-background;
border-radius: $border-radius-round;
position: absolute;
top: 50%;
transform: translateY(-50%) translateX(-50%);
left: 50%;
opacity: 0;
}
.radio__input:not(:disabled):not(:checked) + .radio__label:hover & {
background-color: $L-background-hover;
border-color: $L-border-strong-hover;
}
.radio__input:checked + .radio__label & {
background-color: $L-background-strong;
color: $L-text-weak;
border-color: $L-background-strong;
&:before {
opacity: 1;
}
}
.radio--blue & {
border: 2px solid $L-border-strong;
}
}
import './radio.scss';
<div class="radio
">
<input type="radio" id="radio1" name="radio" value="" class="radio__input" checked>
<label for="radio1" class="radio__label">
<span class="radio__indicator"></span>
<span class="radio__text">Radio label</span>
</label>
</div>
{% set BEM -%}
radio
{% if modifier %} {{ modifier }}{% endif %}
{%- if class %} {{ class }}{% endif %}
{%- if data.isDisabled %} is-disabled{% endif %}
{% endset %}
<div class="{{ BEM }}">
<input
type="radio"
id="{{ data.id }}"
name="{{ data.name }}"
value="{{ data.value }}"
class="radio__input"
{% if data.isChecked %} checked{% endif %}
{% if data.isDisabled %} disabled{% endif %}
{{ data.attributes }}
>
<label for="{{ data.id }}" class="radio__label">
<span class="radio__indicator"></span>
<span class="radio__text">{{ data.label }}</span>
</label>
{% if data.otherChoiceField %}
{% include '@textfield' with { modifier: '', class: 'choice-group__item', data: data.otherChoiceField } %}
{% endif %}
</div>
{
"language": "en-US",
"data": {
"label": "Radio label",
"id": "radio1",
"name": "radio",
"isChecked": true
}
}
.radio {
position: relative;
}
.radio__input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.radio__label {
display: inline-block;
padding-left: 28px;
.radio__input:disabled ~ & {
opacity: .3;
cursor: not-allowed; /* stylelint-disable-line plugin/no-unsupported-browser-features */
}
html[data-whatinput='keyboard'] .radio__input:focus ~ & {
outline-style: auto;
}
}
.radio__text {
font-size: $font-size-base;
font-weight: $font-weight-regular;
color: $L-text-black;
.radio__input:not(:disabled):not(:checked) + .radio__label:hover & {
color: $L-text-hover;
}
}
.radio__indicator {
display: block;
border: 2px solid $L-text;
width: 18px;
height: 18px;
border-radius: $border-radius-round;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
&:before {
content: '';
display: block;
width: 8px;
height: 8px;
background: $L-background;
border-radius: $border-radius-round;
position: absolute;
top: 50%;
transform: translateY(-50%) translateX(-50%);
left: 50%;
opacity: 0;
}
.radio__input:not(:disabled):not(:checked) + .radio__label:hover & {
background-color: $L-background-hover;
border-color: $L-border-strong-hover;
}
.radio__input:checked + .radio__label & {
background-color: $L-background-strong;
color: $L-text-weak;
border-color: $L-background-strong;
&:before {
opacity: 1;
}
}
.radio--blue & {
border: 2px solid $L-border-strong;
}
}
import './radio.scss';
<div class="radio
is-disabled">
<input type="radio" id="radio1" name="radio" value="" class="radio__input" checked disabled>
<label for="radio1" class="radio__label">
<span class="radio__indicator"></span>
<span class="radio__text">Radio label</span>
</label>
</div>
{% set BEM -%}
radio
{% if modifier %} {{ modifier }}{% endif %}
{%- if class %} {{ class }}{% endif %}
{%- if data.isDisabled %} is-disabled{% endif %}
{% endset %}
<div class="{{ BEM }}">
<input
type="radio"
id="{{ data.id }}"
name="{{ data.name }}"
value="{{ data.value }}"
class="radio__input"
{% if data.isChecked %} checked{% endif %}
{% if data.isDisabled %} disabled{% endif %}
{{ data.attributes }}
>
<label for="{{ data.id }}" class="radio__label">
<span class="radio__indicator"></span>
<span class="radio__text">{{ data.label }}</span>
</label>
{% if data.otherChoiceField %}
{% include '@textfield' with { modifier: '', class: 'choice-group__item', data: data.otherChoiceField } %}
{% endif %}
</div>
{
"language": "en-US",
"data": {
"label": "Radio label",
"id": "radio1",
"name": "radio",
"isChecked": true,
"isDisabled": true
}
}
.radio {
position: relative;
}
.radio__input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.radio__label {
display: inline-block;
padding-left: 28px;
.radio__input:disabled ~ & {
opacity: .3;
cursor: not-allowed; /* stylelint-disable-line plugin/no-unsupported-browser-features */
}
html[data-whatinput='keyboard'] .radio__input:focus ~ & {
outline-style: auto;
}
}
.radio__text {
font-size: $font-size-base;
font-weight: $font-weight-regular;
color: $L-text-black;
.radio__input:not(:disabled):not(:checked) + .radio__label:hover & {
color: $L-text-hover;
}
}
.radio__indicator {
display: block;
border: 2px solid $L-text;
width: 18px;
height: 18px;
border-radius: $border-radius-round;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
&:before {
content: '';
display: block;
width: 8px;
height: 8px;
background: $L-background;
border-radius: $border-radius-round;
position: absolute;
top: 50%;
transform: translateY(-50%) translateX(-50%);
left: 50%;
opacity: 0;
}
.radio__input:not(:disabled):not(:checked) + .radio__label:hover & {
background-color: $L-background-hover;
border-color: $L-border-strong-hover;
}
.radio__input:checked + .radio__label & {
background-color: $L-background-strong;
color: $L-text-weak;
border-color: $L-background-strong;
&:before {
opacity: 1;
}
}
.radio--blue & {
border: 2px solid $L-border-strong;
}
}
import './radio.scss';
<div class="radio
radio--blue">
<input type="radio" id="radio1" name="radio" value="" class="radio__input">
<label for="radio1" class="radio__label">
<span class="radio__indicator"></span>
<span class="radio__text">Radio label</span>
</label>
</div>
{% set BEM -%}
radio
{% if modifier %} {{ modifier }}{% endif %}
{%- if class %} {{ class }}{% endif %}
{%- if data.isDisabled %} is-disabled{% endif %}
{% endset %}
<div class="{{ BEM }}">
<input
type="radio"
id="{{ data.id }}"
name="{{ data.name }}"
value="{{ data.value }}"
class="radio__input"
{% if data.isChecked %} checked{% endif %}
{% if data.isDisabled %} disabled{% endif %}
{{ data.attributes }}
>
<label for="{{ data.id }}" class="radio__label">
<span class="radio__indicator"></span>
<span class="radio__text">{{ data.label }}</span>
</label>
{% if data.otherChoiceField %}
{% include '@textfield' with { modifier: '', class: 'choice-group__item', data: data.otherChoiceField } %}
{% endif %}
</div>
{
"language": "en-US",
"data": {
"label": "Radio label",
"id": "radio1",
"name": "radio"
},
"modifier": "radio--blue"
}
.radio {
position: relative;
}
.radio__input {
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.radio__label {
display: inline-block;
padding-left: 28px;
.radio__input:disabled ~ & {
opacity: .3;
cursor: not-allowed; /* stylelint-disable-line plugin/no-unsupported-browser-features */
}
html[data-whatinput='keyboard'] .radio__input:focus ~ & {
outline-style: auto;
}
}
.radio__text {
font-size: $font-size-base;
font-weight: $font-weight-regular;
color: $L-text-black;
.radio__input:not(:disabled):not(:checked) + .radio__label:hover & {
color: $L-text-hover;
}
}
.radio__indicator {
display: block;
border: 2px solid $L-text;
width: 18px;
height: 18px;
border-radius: $border-radius-round;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
&:before {
content: '';
display: block;
width: 8px;
height: 8px;
background: $L-background;
border-radius: $border-radius-round;
position: absolute;
top: 50%;
transform: translateY(-50%) translateX(-50%);
left: 50%;
opacity: 0;
}
.radio__input:not(:disabled):not(:checked) + .radio__label:hover & {
background-color: $L-background-hover;
border-color: $L-border-strong-hover;
}
.radio__input:checked + .radio__label & {
background-color: $L-background-strong;
color: $L-text-weak;
border-color: $L-background-strong;
&:before {
opacity: 1;
}
}
.radio--blue & {
border: 2px solid $L-border-strong;
}
}
import './radio.scss';