Free Flags

Country Dropdown

A searchable select box to pick a country with flag preview.

Live Demo

HTML Code

<div class="country-select">
  <button class="cs-btn" id="csBtn">
    <img src="https://cdn.freeflags.org/flat-circle/australia-flag-flat-circle-64.png"
         width="24" height="24" alt="" />
    <span>Australia</span>
    <span>&#9662;</span>
  </button>
  <div class="cs-menu" id="csMenu">
    <input class="cs-search" type="search"
           placeholder="Search country..." />
    <div class="cs-list">
      <button class="cs-item">
        <img src="...flag-flat-circle-64.png"
             width="20" height="20" alt="" />
        Australia
      </button>
      <!-- more countries... -->
    </div>
  </div>
</div>

CSS Code

.country-select { position: relative; width: 280px; }

.cs-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 14px; border: 1px solid #dce4ef;
  border-radius: 8px; background: white;
  font-size: 15px; font-weight: 700; cursor: pointer;
}

.cs-arrow { margin-left: auto; font-size: 11px; color: #657287; }

.cs-menu {
  display: none; position: absolute; top: calc(100% + 4px);
  left: 0; width: 100%; max-height: 300px;
  border: 1px solid #dce4ef; border-radius: 8px;
  background: white; box-shadow: 0 12px 28px rgba(0,0,0,.12);
  overflow: hidden;
}

.cs-menu.open { display: block; }

.cs-search {
  width: 100%; padding: 10px 14px; border: 0;
  border-bottom: 1px solid #dce4ef; outline: none;
  font-size: 14px;
}

.cs-list { max-height: 240px; overflow-y: auto; padding: 4px; }

.cs-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px; border: 0;
  border-radius: 6px; background: none;
  font-size: 14px; cursor: pointer; text-align: left;
}

.cs-item:hover { background: #f5f8fc; }