组件 搜索框 Glassmorphism 搜索框组件

Glassmorphism 搜索框组件

具有灰度颜色的响应式 glassmorphism 样式搜索框组件,适用于博客或内容网站,具有磨砂玻璃状半透明输入和按钮。包括深色模式支持。

预览

HTML 代码

<div class="flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-900 duration-300 p-4">
  <div class="w-full max-w-md backdrop-blur-md bg-white/20 dark:bg-gray-800/20 rounded-2xl p-6 shadow-lg border border-white/30 dark:border-gray-700/30 transition-all duration-300 ease-in-out">
    <h3 class="text-xl font-semibold text-gray-800 dark:text-gray-100 mb-4 text-center select-none">
      Search Content
    </h3>
    <div class="relative flex items-center w-full">
      <input
        type="text"
        placeholder="Search articles, topics..."
        class="flex-grow py-3 pl-4 pr-12 text-gray-800 dark:text-gray-100 placeholder-gray-600 dark:placeholder-gray-400 bg-white/40 dark:bg-gray-700/40 border border-white/50 dark:border-gray-600/50 rounded-xl focus:outline-none focus:ring-2 focus:ring-gray-400 dark:focus:ring-gray-300 transition-all duration-300 ease-in-out shadow-inner placeholder-shown:italic"
      />
      <button
        class="absolute right-2 top-1/2 -translate-y-1/2 p-2 rounded-lg bg-white/60 dark:bg-gray-700/60 text-gray-800 dark:text-gray-100 hover:bg-white/80 dark:hover:bg-gray-700 hover:scale-105 active:scale-95 transition-all duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-gray-400 dark:focus:ring-gray-300"
      >
        <svg
          xmlns="http://www.w3.org/2000/svg"
          class="h-6 w-6"
          fill="none"
          viewBox="0 0 24 24"
          stroke="currentColor"
          stroke-width="2"
        >
          <path
            stroke-linecap="round"
            stroke-linejoin="round"
            d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
          />
        </svg>
      </button>
    </div>
    <p class="text-xs text-gray-600 dark:text-gray-400 mt-3 text-center select-none">
      Discover new insights and stories.
    </p>
  </div>
</div>

相关组件

复古搜索框

复古/复古搜索框,具有80s/90s美学,响应式,支持黑暗模式。

打开

材料设计搜索框

一个受材料设计原则启发的搜索框组件,使用 Tailwind CSS 构建。它具有响应式行为,能够适应容器宽度,通过悬停和聚焦阴影过渡(深度效果)提供视觉反馈,并全面支持黑暗主题。该组件包括一个领先的搜索图标,并确保干净、现代的美学。仅使用 CSS 实现。由于其 `w-full` 特性,非常适合嵌入各种布局。为确保无障碍,确保将 `input` 元素与相应的 `<label>` 配对,或提供描述性的 `aria-label` 。

打开

搜索框组件

搜索框组件,具有深色模式 UI、单色配色方案和中等复杂性,适用于使用 Tailwind CSS 的社交媒体。支持深色主题的响应式设计。

打开