Input

Input

Text controls share one set of modifiers. Use input on <input>, textarea on <textarea> and select on <select>; every modifier below exists for all three (input-primary, textarea-primary, select-primary).

Class names

Class nameTypeDescription
inputComponentText input
textareaComponentMulti-line text input, vertically resizable
selectComponentSelect; uses the styled picker where the browser supports it
input-primaryColorPrimary border (also textarea-primary, select-primary)
input-secondaryColorSecondary border (also textarea-, select-)
input-successColorSuccess border (also textarea-, select-)
input-warningColorWarning border (also textarea-, select-)
input-infoColorInfo border (also textarea-, select-)
input-dangerColorDanger border (also textarea-, select-)
input-ghostStyleNo border, tinted background (also textarea-ghost, select-ghost)
input-smSizeSmall (also textarea-sm, select-sm)
input-lgSizeLarge (also textarea-lg, select-lg)
disabledStateNative attribute; dims and blocks interaction
:user-invalidStateDanger border after the user has interacted with an invalid value

Input

<input class="input" type="text" aria-label="Name" placeholder="Type here">

Colors

<input class="input input-primary" type="text" aria-label="Primary" placeholder="Primary">
<input class="input input-secondary" type="text" aria-label="Secondary" placeholder="Secondary">
<input class="input input-success" type="text" aria-label="Success" placeholder="Success">
<input class="input input-warning" type="text" aria-label="Warning" placeholder="Warning">
<input class="input input-info" type="text" aria-label="Info" placeholder="Info">
<input class="input input-danger" type="text" aria-label="Danger" placeholder="Danger">

Ghost

<input class="input input-ghost" type="text" aria-label="Ghost" placeholder="Ghost">

Sizes

Medium is the default; there is no input-md class.

<input class="input input-sm" type="text" aria-label="Small" placeholder="Small">
<input class="input" type="text" aria-label="Medium" placeholder="Medium">
<input class="input input-lg" type="text" aria-label="Large" placeholder="Large">

Textarea

<textarea class="textarea" aria-label="Message" placeholder="Your message"></textarea>
<textarea class="textarea textarea-primary textarea-sm" aria-label="Small primary message" placeholder="Small, primary"></textarea>

Select

<select class="select" aria-label="Fruit">
  <option>Apple</option>
  <option>Banana</option>
  <option>Cherry</option>
</select>
<select class="select select-ghost select-lg" aria-label="Large ghost fruit">
  <option>Apple</option>
  <option>Banana</option>
</select>

Disabled

<input class="input" type="text" aria-label="Disabled input" placeholder="Disabled" disabled>
<select class="select" aria-label="Disabled select" disabled>
  <option>Disabled</option>
</select>

Validation

Enter a bad value and leave the field; the border turns danger via :user-invalid.

<input class="input" type="email" aria-label="Email" placeholder="you@example.com" required>

With a field

We never share your address.

<div class="field">
  <label class="field-label" for="input-ex9-email">Email</label>
  <input class="input" id="input-ex9-email" type="email" placeholder="you@example.com" aria-describedby="input-ex9-hint">
  <p class="field-hint" id="input-ex9-hint">We never share your address.</p>
</div>