پیشنمایش زنده
کد HTML
<div class="gl-radio-group" role="radiogroup">
<label class="gl-radio">
<input class="gl-radio__input" type="radio" name="plan" value="free" />
<span class="gl-radio__circle"></span>
<span class="gl-radio__content">
<span class="gl-radio__title">Free</span>
<span class="gl-radio__desc">Up to 3 projects</span>
</span>
</label>
<label class="gl-radio">
<input
class="gl-radio__input"
type="radio"
name="plan"
value="pro"
checked=""
/>
<span class="gl-radio__circle"></span>
<span class="gl-radio__content">
<span class="gl-radio__title">Pro</span>
<span class="gl-radio__desc">Unlimited projects</span>
</span>
</label>
<label class="gl-radio">
<input class="gl-radio__input" type="radio" name="plan" value="team" />
<span class="gl-radio__circle"></span>
<span class="gl-radio__content">
<span class="gl-radio__title">Team</span>
<span class="gl-radio__desc">Collaborative workspace</span>
</span>
</label>
</div>
کد CSS
.gl-radio-group {
display: flex;
flex-direction: column;
gap: 0.65rem;
font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}
.gl-radio {
display: flex;
align-items: center;
gap: 0.9rem;
padding: 0.85rem 1rem;
background: rgba(255, 255, 255, 0.04);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 13px;
cursor: pointer;
transition:
background 0.25s ease,
border-color 0.25s ease,
transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
box-shadow 0.25s ease;
position: relative;
overflow: hidden;
}
.gl-radio::before {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(135deg, rgba(200, 240, 96, 0.05), transparent);
opacity: 0;
transition: opacity 0.3s ease;
}
.gl-radio:hover {
background: rgba(255, 255, 255, 0.07);
border-color: rgba(255, 255, 255, 0.14);
transform: translateX(3px);
}
.gl-radio__input {
position: absolute;
opacity: 0;
width: 0;
height: 0;
pointer-events: none;
}
/* Checked state — card */
.gl-radio__input:checked ~ .gl-radio__circle,
.gl-radio:has(.gl-radio__input:checked) {
/* handled below */
}
.gl-radio:has(.gl-radio__input:checked) {
background: rgba(200, 240, 96, 0.06);
border-color: rgba(200, 240, 96, 0.35);
box-shadow:
0 0 0 1px rgba(200, 240, 96, 0.15),
inset 0 1px 0 rgba(200, 240, 96, 0.08);
transform: translateX(3px);
}
.gl-radio:has(.gl-radio__input:checked)::before {
opacity: 1;
}
/* Outer ring */
.gl-radio__circle {
width: 20px;
height: 20px;
min-width: 20px;
border-radius: 50%;
border: 2px solid rgba(255, 255, 255, 0.15);
background: rgba(255, 255, 255, 0.04);
display: flex;
align-items: center;
justify-content: center;
transition:
border-color 0.25s ease,
background 0.25s ease,
box-shadow 0.25s ease;
}
.gl-radio__circle::after {
content: "";
width: 8px;
height: 8px;
border-radius: 50%;
background: #c8f060;
transform: scale(0);
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
box-shadow: 0 0 8px rgba(200, 240, 96, 0.6);
}
.gl-radio__input:checked ~ .gl-radio__circle {
border-color: rgba(200, 240, 96, 0.6);
background: rgba(200, 240, 96, 0.08);
box-shadow: 0 0 0 3px rgba(200, 240, 96, 0.1);
}
.gl-radio__input:checked ~ .gl-radio__circle::after {
transform: scale(1);
}
.gl-radio__content {
display: flex;
flex-direction: column;
gap: 0.15rem;
}
.gl-radio__title {
font-size: 0.875rem;
font-weight: 600;
color: rgba(255, 255, 255, 0.6);
transition: color 0.25s ease;
line-height: 1;
}
.gl-radio__desc {
font-size: 0.72rem;
color: rgba(255, 255, 255, 0.25);
font-weight: 300;
line-height: 1;
}
.gl-radio:has(.gl-radio__input:checked) .gl-radio__title {
color: rgba(255, 255, 255, 0.92);
}
.gl-radio:has(.gl-radio__input:checked) .gl-radio__desc {
color: rgba(200, 240, 96, 0.6);
}