跳至主要內容

CSS-only Tailwind CSS input with primary, secondary, accent, and semantic color variants. Sizes xs–xl, prefix and suffix addon slots, ghost style. WCAG AA accessible, works with Django, HTMX, Laravel, React, and any stack.

輸入元件透過文字欄位、電子郵件、密碼和其他輸入類型擷取使用者資料。 Frutjam 輸入系統提供具有 Tailwind CSS 樣式的語意 HTML 表單控件,適用於多種尺寸、顏色和驗證狀態。輸入專為可訪問性和響應行為而設計,可與表單驗證庫和框架無縫整合。

僅 CSS,無需 JavaScript。 WCAG AA 可存取且與框架無關 - 可與 Django、HTMX、Laravel、React 和任何堆疊配合使用。

班級 類型 描述
input根據樣式文字輸入字段
input-outline風格帶有可見邊框的透明填充
input-soft風格柔和的有色背景
input-ghost風格聚焦之前沒有可見邊框
input-dashed風格虛線邊框樣式
input-square風格無邊界半徑
input-disabled修飾符非輸入元素的禁用外觀
input-xs尺寸特小號
input-sm尺寸小的
input-md尺寸中(預設)
input-lg尺寸大的
input-xl尺寸特大號
input-2xl尺寸2×特大號
input-primary顏色主要主題顏色邊框
input-secondary顏色次要主題顏色邊框
input-accent顏色強調主題顏色邊框
input-neutral顏色中性主題色邊框
input-info顏色訊息語意顏色邊框
input-success顏色成功語意顏色邊框
input-warning顏色警告語意顏色邊框
input-error顏色錯誤語意顏色邊框

基本用法

<input type="text" placeholder="Enter your text here" class="input">
<input type="text" placeholder="Enter your text here" className="input">

輸入尺寸

html
1
2
3
4
5
6
<input type="text" class="input input-xs" placeholder="Xsmall">
<input type="text" class="input input-sm" placeholder="Small">
<input type="text" class="input input-md" placeholder="Medium">
<input type="text" class="input input-lg" placeholder="Large">
<input type="text" class="input input-xl" placeholder="Xlarge">
<input type="text" class="input input-2xl" placeholder="2XLarge">

輸入色彩

html
1
2
3
4
5
6
7
8
9
<input type="text" class="input" placeholder="Default">
<input type="text" class="input input-primary" placeholder="Primary">
<input type="text" class="input input-secondary" placeholder="Secondary">
<input type="text" class="input input-accent" placeholder="Accent">
<input type="text" class="input input-neutral" placeholder="Neutral">
<input type="text" class="input input-info" placeholder="Info">
<input type="text" class="input input-success" placeholder="Success">
<input type="text" class="input input-warning" placeholder="Warning">
<input type="text" class="input input-error" placeholder="Error">

輸入方式

html
1
2
3
4
5
<input type="text" class="input" placeholder="Default">
<input type="text" class="input input-outline" placeholder="Outline">
<input type="text" class="input input-soft" placeholder="Soft">
<input type="text" class="input input-dashed" placeholder="Dashed">
<input type="text" class="input input-ghost" placeholder="Ghost">

輸入方塊

使用 input-square 進行固定寬度的單字元輸入,例如 OTP 或 PIN 欄位。

html
1
2
3
4
<input type="text" class="input input-square input-xs" maxlength="1" placeholder="0">
<input type="text" class="input input-square input-sm" maxlength="1" placeholder="0">
<input type="text" class="input input-square input-md" maxlength="1" placeholder="0">
<input type="text" class="input input-square input-lg" maxlength="1" placeholder="0">

停用輸入

html
1
2
<input type="text" class="input" placeholder="Enabled input">
<input type="text" class="input input-disabled" placeholder="Disabled input" disabled>

帶標籤輸入

html
1
2
3
4
5
6
7
8
9
<label>
  <span>Email address</span>
  <input type="email" class="input input-outline w-full" placeholder="you@example.com">
</label>

<label>
  <span>Password</span>
  <input type="password" class="input input-outline input-primary w-full" placeholder="Enter password">
</label>