Radio Buttons e Checkboxes Modernos
HTML
<link href="" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.1/font/bootstrap-icons.min.css" rel="stylesheet">
<div class="container py-5">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="form-container p-4">
<h1 class="section-title">
<i class="bi bi-ui-checks-grid"></i> Formulário Moderno
</h1>
<form>
<!-- Radio Buttons Section -->
<div class="form-section">
<h3 class="h4 mb-4 text-primary fw-bold">
<i class="bi bi-radioactive"></i> Escolha seu Plano
</h3>
<div class="custom-radio">
<input type="radio" id="plan1" name="plan" value="basic">
<label for="plan1" class="custom-label">
<div class="custom-indicator radio-indicator">
<i class="bi bi-circle-fill"></i>
</div>
<div class="label-content">
<div class="label-title">Plano Básico</div>
<p class="label-description">Ideal para iniciantes - R$ 29,90/mês</p>
</div>
<i class="bi bi-star label-icon"></i>
</label>
</div>
<div class="custom-radio">
<input type="radio" id="plan2" name="plan" value="pro">
<label for="plan2" class="custom-label">
<div...
CSS
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.form-container {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(20px);
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.custom-radio,
.custom-checkbox {
position: relative;
margin-bottom: 1rem;
}
.custom-radio input[type="radio"],
.custom-checkbox input[type="checkbox"] {
position: absolute;
opacity: 0;
cursor: pointer;
}
.custom-label {
display: flex;
align-items: center;
padding: 15px 20px;
background: #f8f9fa;
border: 2px solid #e9ecef;
border-radius: 12px;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.custom-label:hover {
background: #e3f2fd;
border-color: #2196f3;
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(33, 150, 243, 0.15);
}
.custom-radio input[type="radio"]:checked + .custom-label,
.custom-checkbox input[type="checkbox"]:checked + .custom-label {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-color: #667eea;
color: white;
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}
.custom-indicator {
width: 24px;
height: 24px;
border: 2px solid #dee2e6;
margin-right: 15px;
position: relative;
transition: all 0.3s ease;
...
JavaScript
// Adicionar interatividade extra
document.addEventListener('DOMContentLoaded', function() {
// Animação ao selecionar radio buttons
const radioInputs = document.querySelectorAll('input[type="radio"]');
radioInputs.forEach(input => {
input.addEventListener('change', function() {
// Remove active class de todos os radio buttons do mesmo grupo
const name = this.name;
document.querySelectorAll(`input[name="${name}"]`).forEach(radio => {
radio.closest('.custom-radio').classList.remove('active');
});
// Adiciona active class ao selecionado
this.closest('.custom-radio').classList.add('active');
});
});
// Animação ao selecionar checkboxes
const checkboxInputs = document.querySelectorAll('input[type="checkbox"]');
checkboxInputs.forEach(input => {
input.addEventListener('change', function() {
if (this.checked) {
this.closest('.custom-checkbox, .switch-container').classList.add('active');
} else {
this.closest('.custom-checkbox, .switch-container').classList.remove('active');
}
});
});
// Feedback visual no submit
const form = document.querySelector('form');
form.addEventListener('submit', function(e) {
e.preventDefault();
const button = this.querySelector('.btn-submit');
const originalText = button.innerHTML;
button.innerHTML = '<i class="bi bi-check-circle-fill me-2"></i>Processando...';
button.disabled = true;
setTimeout(() => {
...