Interactive FAQ Accordion

Intermediate

A modern and accessible FAQ accordion component with smooth animations, search functionality, and category filtering

Live Preview

Code Implementation

HTML
<section class="faq-section">
  <div class="container">
    <!-- Header -->
    <div class="faq-header">
      <h2 class="faq-title">Frequently Asked Questions</h2>
      <p class="faq-subtitle">Find answers to common questions about our products and services</p>
    </div>

    <!-- Search and Filter Controls -->
    <div class="faq-controls">
      <!-- Search Bar -->
      <div class="search-container">
        <div class="search-input-wrapper">
          <svg class="search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
            <circle cx="11" cy="11" r="8"></circle>
            <path d="m21 21-4.35-4.35"></path>
          </svg>
          <input 
            type="text" 
            id="faqSearch" 
            class="search-input" 
            placeholder="Search questions..."
            aria-label="Search FAQ questions"
          >
          <button class="search-clear" id="searchClear" aria-label="Clear search">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <line x1="18" y1="6" x2="6" y2="18"></line>
              <line x1="6" y1="6" x2="18" y2="18"></line>
            </svg>
          </button>
        </div>
      </div>

      <!-- Category Filter -->
      <div class="filter-container">
        <div class="filter-buttons" role="tablist" aria-label="FAQ Categories">
          <button class="filter-btn active" data-category="all" role="tab" aria-selected="true">
            All Questions
          </button>
          <button class="filter-btn" data-category="general" role="tab" aria-selected="false">
            General
          </button>
          <button class="filter-btn" data-category="billing" role="tab" aria-selected="false">
            Billing
          </button>
          <button class="filter-btn" data-category="technical" role="tab" aria-selected="false">
            Technical
          </button>
          <button class="filter-btn" data-category="account" role="tab" aria-selected="false">
            Account
          </button>
        </div>
      </div>
    </div>

    <!-- FAQ Results Info -->
    <div class="faq-results" id="faqResults">
      <span class="results-count">Showing <strong>12</strong> questions</span>
    </div>

    <!-- FAQ Accordion -->
    <div class="faq-accordion" id="faqAccordion">
      <!-- General Questions -->
      <div class="faq-item" data-category="general">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-1">
          <span class="question-text">What is your company about?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-1" aria-hidden="true">
          <div class="answer-content">
            <p>We are a technology company focused on creating innovative solutions that help businesses grow and succeed in the digital age. Our team of experts works tirelessly to develop cutting-edge products and services.</p>
            <p>Founded in 2019, we have grown from a small startup to a leading provider of digital solutions, serving thousands of customers worldwide.</p>
          </div>
        </div>
      </div>

      <div class="faq-item" data-category="general">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-2">
          <span class="question-text">How long have you been in business?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-2" aria-hidden="true">
          <div class="answer-content">
            <p>We have been in business since 2019, which means we have over 5 years of experience in the industry. During this time, we have:</p>
            <ul>
              <li>Served over 10,000 customers</li>
              <li>Launched 15+ successful products</li>
              <li>Expanded to 25 countries</li>
              <li>Built a team of 100+ professionals</li>
            </ul>
          </div>
        </div>
      </div>

      <!-- Billing Questions -->
      <div class="faq-item" data-category="billing">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-3">
          <span class="question-text">What payment methods do you accept?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-3" aria-hidden="true">
          <div class="answer-content">
            <p>We accept all major payment methods to make it convenient for our customers:</p>
            <ul>
              <li><strong>Credit Cards:</strong> Visa, MasterCard, American Express, Discover</li>
              <li><strong>Digital Wallets:</strong> PayPal, Apple Pay, Google Pay</li>
              <li><strong>Bank Transfers:</strong> ACH, Wire transfers</li>
              <li><strong>Cryptocurrency:</strong> Bitcoin, Ethereum (for enterprise plans)</li>
            </ul>
            <p>All payments are processed securely using industry-standard encryption.</p>
          </div>
        </div>
      </div>

      <div class="faq-item" data-category="billing">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-4">
          <span class="question-text">Can I get a refund?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-4" aria-hidden="true">
          <div class="answer-content">
            <p>Yes, we offer a 30-day money-back guarantee for all our services. If you're not completely satisfied, you can request a full refund within 30 days of your purchase.</p>
            <p><strong>Refund Process:</strong></p>
            <ol>
              <li>Contact our support team</li>
              <li>Provide your order number</li>
              <li>Explain the reason for refund</li>
              <li>Receive confirmation within 24 hours</li>
              <li>Refund processed within 5-7 business days</li>
            </ol>
          </div>
        </div>
      </div>

      <!-- Technical Questions -->
      <div class="faq-item" data-category="technical">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-5">
          <span class="question-text">What are the system requirements?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-5" aria-hidden="true">
          <div class="answer-content">
            <p>Our platform is designed to work on all modern devices and browsers:</p>
            <div class="requirements-grid">
              <div class="requirement-item">
                <h4>Desktop Browsers</h4>
                <ul>
                  <li>Chrome 80+</li>
                  <li>Firefox 75+</li>
                  <li>Safari 13+</li>
                  <li>Edge 80+</li>
                </ul>
              </div>
              <div class="requirement-item">
                <h4>Mobile Devices</h4>
                <ul>
                  <li>iOS 13+ (Safari)</li>
                  <li>Android 8+ (Chrome)</li>
                  <li>Responsive design</li>
                  <li>Touch optimized</li>
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="faq-item" data-category="technical">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-6">
          <span class="question-text">Do you provide API access?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-6" aria-hidden="true">
          <div class="answer-content">
            <p>Yes, we provide comprehensive API access for developers and businesses who want to integrate our services:</p>
            <ul>
              <li><strong>REST API:</strong> Full CRUD operations with JSON responses</li>
              <li><strong>GraphQL:</strong> Flexible queries for advanced use cases</li>
              <li><strong>Webhooks:</strong> Real-time notifications for events</li>
              <li><strong>SDKs:</strong> Available for Python, JavaScript, PHP, and more</li>
            </ul>
            <p>API documentation and interactive testing tools are available in our developer portal.</p>
          </div>
        </div>
      </div>

      <!-- Account Questions -->
      <div class="faq-item" data-category="account">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-7">
          <span class="question-text">How do I reset my password?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-7" aria-hidden="true">
          <div class="answer-content">
            <p>You can reset your password easily through our secure password reset process:</p>
            <ol>
              <li>Go to the login page</li>
              <li>Click "Forgot Password?"</li>
              <li>Enter your email address</li>
              <li>Check your email for reset instructions</li>
              <li>Follow the link and create a new password</li>
            </ol>
            <p><strong>Security Note:</strong> Reset links expire after 1 hour for security purposes.</p>
          </div>
        </div>
      </div>

      <div class="faq-item" data-category="account">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-8">
          <span class="question-text">Can I change my email address?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-8" aria-hidden="true">
          <div class="answer-content">
            <p>Yes, you can change your email address from your account settings:</p>
            <ol>
              <li>Log in to your account</li>
              <li>Go to Account Settings</li>
              <li>Click on "Change Email"</li>
              <li>Enter your new email address</li>
              <li>Verify the new email through the confirmation link</li>
            </ol>
            <p>Your old email will remain active until you confirm the new one.</p>
          </div>
        </div>
      </div>

      <!-- More General Questions -->
      <div class="faq-item" data-category="general">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-9">
          <span class="question-text">Do you offer customer support?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-9" aria-hidden="true">
          <div class="answer-content">
            <p>Absolutely! We provide comprehensive customer support through multiple channels:</p>
            <ul>
              <li><strong>24/7 Live Chat:</strong> Instant help from our support team</li>
              <li><strong>Email Support:</strong> Detailed responses within 4 hours</li>
              <li><strong>Phone Support:</strong> Direct line for urgent issues</li>
              <li><strong>Knowledge Base:</strong> Self-service articles and tutorials</li>
              <li><strong>Community Forum:</strong> Connect with other users</li>
            </ul>
          </div>
        </div>
      </div>

      <div class="faq-item" data-category="technical">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-10">
          <span class="question-text">Is my data secure?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-10" aria-hidden="true">
          <div class="answer-content">
            <p>Data security is our top priority. We implement multiple layers of protection:</p>
            <ul>
              <li><strong>Encryption:</strong> AES-256 encryption for data at rest and in transit</li>
              <li><strong>Compliance:</strong> SOC 2 Type II, GDPR, and HIPAA compliant</li>
              <li><strong>Access Control:</strong> Multi-factor authentication and role-based permissions</li>
              <li><strong>Monitoring:</strong> 24/7 security monitoring and threat detection</li>
              <li><strong>Backups:</strong> Automated daily backups with 99.9% uptime guarantee</li>
            </ul>
          </div>
        </div>
      </div>

      <div class="faq-item" data-category="billing">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-11">
          <span class="question-text">Can I upgrade or downgrade my plan?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-11" aria-hidden="true">
          <div class="answer-content">
            <p>Yes, you can change your plan at any time. Here's how it works:</p>
            <div class="plan-changes">
              <div class="change-type">
                <h4>Upgrading</h4>
                <ul>
                  <li>Immediate access to new features</li>
                  <li>Prorated billing for the current period</li>
                  <li>No service interruption</li>
                </ul>
              </div>
              <div class="change-type">
                <h4>Downgrading</h4>
                <ul>
                  <li>Changes take effect at next billing cycle</li>
                  <li>Data export available before downgrade</li>
                  <li>Credit applied to future bills</li>
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="faq-item" data-category="account">
        <button class="faq-question" aria-expanded="false" aria-controls="faq-12">
          <span class="question-text">How do I delete my account?</span>
          <span class="question-icon">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
              <polyline points="6,9 12,15 18,9"></polyline>
            </svg>
          </span>
        </button>
        <div class="faq-answer" id="faq-12" aria-hidden="true">
          <div class="answer-content">
            <p>We're sorry to see you go! You can delete your account through the following process:</p>
            <ol>
              <li>Log in to your account</li>
              <li>Go to Account Settings</li>
              <li>Scroll to "Danger Zone"</li>
              <li>Click "Delete Account"</li>
              <li>Confirm deletion via email</li>
            </ol>
            <p><strong>Important:</strong> This action is irreversible. All your data will be permanently deleted within 30 days.</p>
          </div>
        </div>
      </div>
    </div>

    <!-- No Results Message -->
    <div class="no-results" id="noResults" style="display: none;">
      <div class="no-results-content">
        <svg class="no-results-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
          <circle cx="11" cy="11" r="8"></circle>
          <path d="m21 21-4.35-4.35"></path>
        </svg>
        <h3>No questions found</h3>
        <p>Try adjusting your search terms or browse different categories.</p>
        <button class="reset-search-btn" onclick="resetSearch()">Clear Search</button>
      </div>
    </div>

    <!-- Contact Support -->
    <div class="faq-footer">
      <div class="support-cta">
        <h3>Still have questions?</h3>
        <p>Can't find what you're looking for? Our support team is here to help.</p>
        <div class="support-buttons">
          <a href="#" class="support-btn primary">Contact Support</a>
          <a href="#" class="support-btn secondary">Live Chat</a>
        </div>
      </div>
    </div>
  </div>
</section>

Snippet Features

Responsive Design: Yes
Dark Mode Support: No
Category: feature-sections
Difficulty Level: Intermediate