widgets
advanced
calendar
widget
events
scheduling
date-picker
responsive
Category · Widgets Difficulty Level · Advanced Published on · August 18, 2025

Calendar Widget

Interactive calendar widget with event management, date selection, and multiple view modes for scheduling and planning.

#calendar #widget #events #scheduling #date-picker #responsive

Responsive Design

Yes

Dark Mode Support

No

lines

1188

Browser Compatibility

Chrome · Firefox · Safari · Edge

Live Preview

Interact with the component without leaving the page.

700px

Overview

Interactive calendar widget with event management, date selection, and multiple view modes for scheduling and planning.

How to use

  1. Copy the HTML markup into your page.
  2. Paste the CSS into your stylesheet and ensure the selectors match your markup.
  3. Paste the JavaScript and load it after the markup.
  4. Adjust spacing, colors, and text to match your design system.

Customization tips

  • Rename class names to avoid collisions with your existing CSS.
  • Replace hard-coded colors with CSS variables for theming.
  • Verify the layout at 320px, 768px, and 1024px widths.

HTML

162

lines

CSS

628

lines

JavaScript

398

lines


                <div class="calendar-container">
  <div class="calendar-header">
    <h1 class="calendar-title">Interactive Calendar Widget</h1>
    <p class="calendar-subtitle">Full-featured calendar with event management and multiple view modes</p>
  </div>
  
  <div class="calendar-widget">
    <div class="calendar-controls">
      <div class="calendar-nav">
        <button class="nav-btn" id="prevMonth">
          <svg viewBox="0 0 24 24" fill="currentColor">
            <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
          </svg>
        </button>
        
        <div class="current-month">
          <h2 id="currentMonth">January 2025</h2>
          <button class="today-btn" id="todayBtn">Today</button>
        </div>
        
        <button class="nav-btn" id="nextMonth">
          <svg viewBox="0 0 24 24" fill="currentColor">
            <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
          </svg>
        </button>
      </div>
      
      <div class="view-controls">
        <div class="view-buttons">
          <button class="view-btn active" data-view="month">Month</button>
          <button class="view-btn" data-view="week">Week</button>
          <button class="view-btn" data-view="day">Day</button>
        </div>
        
        <button class="add-event-btn" id="addEventBtn">
          <svg viewBox="0 0 24 24" fill="currentColor">
            <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
          </svg>
          Add Event
        </button>
      </div>
    </div>
    
    <div class="calendar-main">
      <div class="calendar-grid" id="calendarGrid">
        <div class="weekdays">
          <div class="weekday">Sun</div>
          <div class="weekday">Mon</div>
          <div class="weekday">Tue</div>
          <div class="weekday">Wed</div>
          <div class="weekday">Thu</div>
          <div class="weekday">Fri</div>
          <div class="weekday">Sat</div>
        </div>
        
        <div class="calendar-days" id="calendarDays">
          
        </div>
      </div>
      
      <div class="calendar-sidebar">
        <div class="mini-calendar">
          <h3>Quick Navigation</h3>
          <div class="mini-months" id="miniMonths">
            
          </div>
        </div>
        
        <div class="upcoming-events">
          <h3>Upcoming Events</h3>
          <div class="events-list" id="eventsList">
            
          </div>
        </div>
        
        <div class="calendar-stats">
          <h3>Statistics</h3>
          <div class="stats-grid">
            <div class="stat-item">
              <span class="stat-number" id="totalEvents">0</span>
              <span class="stat-label">Total Events</span>
            </div>
            <div class="stat-item">
              <span class="stat-number" id="thisMonth">0</span>
              <span class="stat-label">This Month</span>
            </div>
            <div class="stat-item">
              <span class="stat-number" id="todayEvents">0</span>
              <span class="stat-label">Today</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  
  
  <div class="modal-overlay" id="eventModal">
    <div class="modal-content">
      <div class="modal-header">
        <h3 id="modalTitle">Add New Event</h3>
        <button class="modal-close" id="modalClose">
          <svg viewBox="0 0 24 24" fill="currentColor">
            <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
          </svg>
        </button>
      </div>
      
      <form class="event-form" id="eventForm">
        <div class="form-group">
          <label for="eventTitle">Event Title</label>
          <input type="text" id="eventTitle" required placeholder="Enter event title">
        </div>
        
        <div class="form-row">
          <div class="form-group">
            <label for="eventDate">Date</label>
            <input type="date" id="eventDate" required>
          </div>
          
          <div class="form-group">
            <label for="eventTime">Time</label>
            <input type="time" id="eventTime">
          </div>
        </div>
        
        <div class="form-group">
          <label for="eventDescription">Description</label>
          <textarea id="eventDescription" placeholder="Event description (optional)"></textarea>
        </div>
        
        <div class="form-row">
          <div class="form-group">
            <label for="eventCategory">Category</label>
            <select id="eventCategory">
              <option value="work">Work</option>
              <option value="personal">Personal</option>
              <option value="meeting">Meeting</option>
              <option value="reminder">Reminder</option>
              <option value="holiday">Holiday</option>
            </select>
          </div>
          
          <div class="form-group">
            <label for="eventPriority">Priority</label>
            <select id="eventPriority">
              <option value="low">Low</option>
              <option value="medium" selected>Medium</option>
              <option value="high">High</option>
            </select>
          </div>
        </div>
        
        <div class="form-actions">
          <button type="button" class="btn-secondary" id="cancelBtn">Cancel</button>
          <button type="submit" class="btn-primary" id="saveBtn">Save Event</button>
          <button type="button" class="btn-danger" id="deleteBtn" style="display: none;">Delete</button>
        </div>
      </form>
    </div>
  </div>
</div>

              
162lines
5626characters
HTMLLanguage

Browser Compatibility

Chrome

>= 60

Firefox

>= 55

Safari

>= 10

Edge

>= 15

Related Code Snippets

Explore template packs

Need larger building blocks? Browse responsive landing pages and component bundles.

Open HTML Template Library ->