Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <body>
  <div class="feedback-container">
    <div class="steps">
      <div class="step active"></div>
      <div class="step"></div>
      <div class="step"></div>
      <div class="step"></div>
    </div>

    <h2>We'd love your feedback!</h2>
    <p class="subtitle">Help us make our product even better for you.</p>

    <form id="feedbackForm" novalidate>
      <div class="input-group">
        <label>What aspects are you reviewing?</label>
        <div class="tags" role="group" aria-label="Select categories">
          <button type="button" class="tag" role="checkbox" aria-checked="false">User Interface</button>
          <button type="button" class="tag" role="checkbox" aria-checked="false">Performance</button>
          <button type="button" class="tag" role="checkbox" aria-checked="false">Features</button>
          <button type="button" class="tag" role="checkbox" aria-checked="false">Support</button>
          <button type="button" class="tag" role="checkbox" aria-checked="false">Documentation</button>
        </div>
        <div class="validation-message"></div>
      </div>

      <div class="input-group">
        <label>How was your experience?</label>
        <div class="mood-selector" role="radiogroup" aria-label="Rate your experience">
          <div class="mood" role="radio" tabindex="0" aria-checked="false">
            <span class="mood-emoji" aria-hidden="true">😞</span>
            <span class="mood-label">Poor</span>
          </div>
          <div class="mood" role="radio" tabindex="0" aria-checked="false">
            <span class="mood-emoji" aria-hidden="true">😐</span>
            <span class="mood-label">Okay</span>
          </div>
          <div class="mood" role="radio" tabindex="0" aria-checked="false">
            <span class="mood-emoji" aria-hidden="true">🙂</span>
            <span class="mood-label">Good</span>
          </div>
          <div class="mood" role="radio" tabindex="0" aria-checked="false">
            <span class="mood-emoji" aria-hidden="true">😊</span>
            <span class="mood-label">Great</span>
          </div>
          <div class="mood" role="radio" tabindex="0" aria-checked="false">
            <span class="mood-emoji" aria-hidden="true">🤩</span>
            <span class="mood-label">Amazing</span>
          </div>
        </div>
        <div class="validation-message"></div>
      </div>

      <div class="input-group">
        <label for="feedback">Tell us more about it</label>
        <textarea 
          id="feedback" 
          placeholder="Share your thoughts and suggestions..." 
          maxlength="500" 
          required
          aria-required="true"
        ></textarea>
        <div class="char-counter">0/500</div>
        <div class="validation-message"></div>
      </div>

      <button type="submit" class="submit-btn">Submit Feedback</button>
    </form>
  </div>
</body>
              
            
!

CSS

              
                  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: 'Inter', -apple-system, sans-serif;
    }

    body {
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #0f172a;
      padding: 20px;
      color: #fff;
    }

    .feedback-container {
      width: 100%;
      max-width: 600px;
      background: #1e293b;
      border-radius: 24px;
      padding: 2rem;
      position: relative;
      overflow: hidden;
      animation: fadeIn 0.5s ease-out;
    }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(20px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .feedback-container::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 6px;
      background: linear-gradient(90deg, #00f5a0 0%, #00d9f5 100%);
    }

    .steps {
      display: flex;
      gap: 10px;
      margin-bottom: 2rem;
    }

    .step {
      width: 25%;
      height: 3px;
      background: #334155;
      border-radius: 4px;
      transition: all 0.3s ease;
    }

    .step.active {
      background: #00f5a0;
      box-shadow: 0 0 10px rgba(0, 245, 160, 0.3);
    }

    h2 {
      font-size: 1.75rem;
      margin-bottom: 0.5rem;
      background: linear-gradient(90deg, #00f5a0 0%, #00d9f5 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .subtitle {
      color: #94a3b8;
      margin-bottom: 2rem;
    }

    .input-group {
      margin-bottom: 1.5rem;
      position: relative;
    }

    .input-group label {
      display: block;
      margin-bottom: 0.5rem;
      color: #e2e8f0;
      font-size: 0.9rem;
    }

    .input-group input,
    .input-group textarea {
      width: 100%;
      padding: 1rem;
      background: #334155;
      border: 2px solid transparent;
      border-radius: 12px;
      color: #fff;
      font-size: 1rem;
      transition: all 0.3s ease;
    }

    .input-group input:focus,
    .input-group textarea:focus {
      outline: none;
      border-color: #00f5a0;
      background: #475569;
      box-shadow: 0 0 0 4px rgba(0, 245, 160, 0.15);
    }

    .input-group input.invalid,
    .input-group textarea.invalid {
      border-color: #ff4d4d;
    }

    .input-group input.invalid:focus,
    .input-group textarea.invalid:focus {
      box-shadow: 0 0 0 4px rgba(255, 77, 77, 0.15);
    }

    .validation-message {
      position: absolute;
      bottom: -20px;
      left: 0;
      color: #ff4d4d;
      font-size: 0.8rem;
      opacity: 0;
      transform: translateY(-10px);
      transition: all 0.3s ease;
    }

    .validation-message.visible {
      opacity: 1;
      transform: translateY(0);
    }

    .input-group textarea {
      height: 120px;
      resize: vertical;
    }

    .char-counter {
      position: absolute;
      right: 1rem;
      bottom: 1rem;
      color: #94a3b8;
      font-size: 0.8rem;
      pointer-events: none;
    }

    .tags {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-bottom: 1.5rem;
    }

    .tag {
      padding: 0.75rem 1.25rem;
      background: #334155;
      border: none;
      border-radius: 100px;
      color: #fff;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      overflow: hidden;
    }

    .tag:hover {
      background: #475569;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 245, 160, 0.15);
    }

    .tag:focus {
      outline: none;
      box-shadow: 0 0 0 3px rgba(0, 245, 160, 0.3);
    }

    .tag.active {
      background: #00f5a0;
      color: #0f172a;
      font-weight: 600;
    }

    .mood-selector {
      display: flex;
      justify-content: space-between;
      margin-bottom: 2rem;
    }

    .mood {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      transition: all 0.3s ease;
      padding: 0.5rem;
      border-radius: 12px;
    }

    .mood:hover {
      background: #334155;
    }

    .mood:hover .mood-emoji {
      transform: scale(1.2);
    }

    .mood-emoji {
      font-size: 2rem;
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mood.selected {
      background: #334155;
    }

    .mood.selected .mood-label {
      color: #00f5a0;
    }

    .mood-label {
      font-size: 0.8rem;
      color: #94a3b8;
      transition: color 0.3s ease;
    }

    .submit-btn {
      width: 100%;
      padding: 1rem;
      background: linear-gradient(90deg, #00f5a0 0%, #00d9f5 100%);
      border: none;
      border-radius: 12px;
      color: #0f172a;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      overflow: hidden;
    }

    .submit-btn:hover {
      opacity: 0.9;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 245, 160, 0.2);
    }

    .submit-btn:focus {
      outline: none;
      box-shadow: 0 0 0 4px rgba(0, 245, 160, 0.3);
    }

    .ripple {
      position: absolute;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.3);
      transform: scale(0);
      animation: ripple 0.6s linear;
      pointer-events: none;
    }

    @keyframes ripple {
      to {
        transform: scale(4);
        opacity: 0;
      }
    }

    @media (max-width: 480px) {
      .feedback-container {
        padding: 1.5rem;
      }

      .mood-selector {
        flex-wrap: wrap;
        gap: 1rem;
        justify-content: center;
      }

      .mood {
        width: 30%;
      }
    }
              
            
!

JS

              
                    // Ripple effect
    function createRipple(event) {
      const button = event.currentTarget;
      const ripple = document.createElement('span');
      
      const diameter = Math.max(button.clientWidth, button.clientHeight);
      const radius = diameter / 2;
      
      ripple.style.width = ripple.style.height = `${diameter}px`;
      ripple.style.left = `${event.clientX - button.offsetLeft - radius}px`;
      ripple.style.top = `${event.clientY - button.offsetTop - radius}px`;
      ripple.className = 'ripple';
      
      button.appendChild(ripple);
      
      ripple.addEventListener('animationend', () => {
        ripple.remove();
      });
    }

    // Tag selection
    const tags = document.querySelectorAll('.tag');
    tags.forEach(tag => {
      tag.addEventListener('click', () => {
        tag.classList.toggle('active');
        tag.setAttribute('aria-checked', tag.classList.contains('active'));
      });

      tag.addEventListener('click', createRipple);
    });

    // Mood selection
    const moods = document.querySelectorAll('.mood');
    moods.forEach(mood => {
      mood.addEventListener('click', () => {
        moods.forEach(m => {
          m.classList.remove('selected');
          m.setAttribute('aria-checked', 'false');
        });
        mood.classList.add('selected');
        mood.setAttribute('aria-checked', 'true');
      });

      // Keyboard navigation
      mood.addEventListener('keypress', (e) => {
        if (e.key === 'Enter' || e.key === ' ') {
          e.preventDefault();
          mood.click();
        }
      });
    });

    // Character counter
    const textarea = document.querySelector('textarea');
    const charCounter = document.querySelector('.char-counter');
    
    textarea.addEventListener('input', () => {
      const length = textarea.value.length;
      charCounter.textContent = `${length}/500`;
    });

    // Form validation
    const form = document.getElementById('feedbackForm');
    
    form.addEventListener('submit', (e) => {
      e.preventDefault();
      let isValid = true;

      // Validate tags
      const selectedTags = document.querySelectorAll('.tag.active');
      if (selectedTags.length === 0) {
        isValid = false;
        showError(tags[0].parentElement, 'Please select at least one category');
      }

      // Validate mood
      const selectedMood = document.querySelector('.mood.selected');
      if (!selectedMood) {
        isValid = false;
        showError(moods[0].parentElement, 'Please select your experience rating');
      }

      // Validate textarea
      if (!textarea.value.trim()) {
        isValid = false;
        showError(textarea, 'Please provide your feedback');
      }

      if (isValid) {
        // Add success animation or submit form
        console.log('Form submitted successfully');
      }
    });

    function showError(element, message) {
      const validationMessage = element.parentElement.querySelector('.validation-message');
      validationMessage.textContent = message;
      validationMessage.classList.add('visible');
      
      if (element.classList) {
        element.classList.add('invalid');
      }

      setTimeout(() => {
        validationMessage.classList.remove('visible');
        if (element.classList) {
          element.classList.remove('invalid');
        }
      }, 3000);
    }

    // Add ripple to submit button
    document.querySelector('.submit-btn').addEventListener('click', createRipple);
              
            
!
999px

Console