Get 20% off with code BULMA
Valid until the end of November 2024
Download

Sponsor

Route Planner and Route Optimizer

Input


The text input and its variations

The Bulma input CSS class is meant for <input> HTML elements. The following type attributes are supported:

  • type="text"
  • type="password"
  • type="email"
  • type="tel"

Several modifiers are supported which affect:

<input class="input" type="text" placeholder="Text input" />

Colors #

Example

HTML

<input
  class="input is-link"
  type="text"
  placeholder="Link input"
/>

Example

HTML

<input
  class="input is-primary"
  type="text"
  placeholder="Primary input"
/>

Example

HTML

<input
  class="input is-info"
  type="text"
  placeholder="Info input"
/>

Example

HTML

<input
  class="input is-success"
  type="text"
  placeholder="Success input"
/>

Example

HTML

<input
  class="input is-warning"
  type="text"
  placeholder="Warning input"
/>

Example

HTML

<input
  class="input is-danger"
  type="text"
  placeholder="Danger input"
/>

Sizes #

Example

HTML

<input
  class="input is-small"
  type="text"
  placeholder="Small input"
/>

Example

HTML

<input
  class="input is-normal"
  type="text"
  placeholder="Normal input"
/>

Example

HTML

<input
  class="input is-medium"
  type="text"
  placeholder="Medium input"
/>

Example

HTML

<input
  class="input is-large"
  type="text"
  placeholder="Large input"
/>

Styles #

<input class="input is-rounded" type="text" placeholder="Rounded input" />

States #

Normal

<div class="control">
  <input class="input" type="text" placeholder="Normal input" />
</div>

Hover

<div class="control">
  <input class="input is-hovered" type="text" placeholder="Hovered input" />
</div>

Focus

<div class="control">
  <input class="input is-focused" type="text" placeholder="Focused input" />
</div>

Loading

<div class="control is-loading">
  <input class="input" type="text" placeholder="Loading input" />
</div>

You can resize the loading spinner by appending is-small, is-medium or is-large to the control container.

<div class="field">
  <div class="control is-small is-loading">
    <input
      class="input is-small"
      type="text"
      placeholder="Small loading input"
    />
  </div>
</div>
<div class="field">
  <div class="control is-loading">
    <input class="input" type="text" placeholder="Normal loading input" />
  </div>
</div>
<div class="field">
  <div class="control is-medium is-loading">
    <input
      class="input is-medium"
      type="text"
      placeholder="Medium loading input"
    />
  </div>
</div>
<div class="field">
  <div class="control is-large is-loading">
    <input
      class="input is-large"
      type="text"
      placeholder="Large loading input"
    />
  </div>
</div>

Disabled

<div class="control">
  <input class="input" type="text" placeholder="Disabled input" disabled />
</div>

Readonly and static inputs

If you use the readonly HTML attribute, the input will look similar to a normal one, but is not editable and has no shadow.

<div class="control">
  <input class="input" type="text" value="This text is readonly" readonly />
</div>

If you also append the is-static modifier, it removes the background, border, shadow, and horizontal padding, while maintaining the vertical spacing so you can easily align the input in any context, like a horizontal form.

<div class="field is-horizontal">
  <div class="field-label is-normal">
    <label class="label">From</label>
  </div>
  <div class="field-body">
    <div class="field">
      <p class="control">
        <input
          class="input is-static"
          type="email"
          value="[email protected]"
          readonly
        />
      </p>
    </div>
  </div>
</div>

<div class="field is-horizontal">
  <div class="field-label is-normal">
    <label class="label">To</label>
  </div>
  <div class="field-body">
    <div class="field">
      <p class="control">
        <input class="input" type="email" placeholder="Recipient email" />
      </p>
    </div>
  </div>
</div>

With Font Awesome icons #

You can append one of 2 modifiers on a control:

  • has-icons-left
  • and/or has-icons-right

You also need to add a modifier on the icon:

  • icon is-left if has-icons-left is used
  • icon is-right if has-icons-right is used

The size of the input will define the size of the icon container.

<div class="field">
  <p class="control has-icons-left has-icons-right">
    <input class="input" type="email" placeholder="Email" />
    <span class="icon is-small is-left">
      <i class="fas fa-envelope"></i>
    </span>
    <span class="icon is-small is-right">
      <i class="fas fa-check"></i>
    </span>
  </p>
</div>
<div class="field">
  <p class="control has-icons-left">
    <input class="input" type="password" placeholder="Password" />
    <span class="icon is-small is-left">
      <i class="fas fa-lock"></i>
    </span>
  </p>
</div>

If the control contains an icon, Bulma will make sure the icon remains centered, no matter the size of the input or of the icon.

<div class="control has-icons-left has-icons-right">
  <input class="input is-small" type="email" placeholder="Email" />
  <span class="icon is-small is-left">
    <i class="fas fa-envelope"></i>
  </span>
  <span class="icon is-small is-right">
    <i class="fas fa-check"></i>
  </span>
</div>
<div class="control has-icons-left has-icons-right">
  <input class="input" type="email" placeholder="Email" />
  <span class="icon is-small is-left">
    <i class="fas fa-envelope"></i>
  </span>
  <span class="icon is-small is-right">
    <i class="fas fa-check"></i>
  </span>
</div>
<div class="control has-icons-left has-icons-right">
  <input class="input is-medium" type="email" placeholder="Email" />
  <span class="icon is-left">
    <i class="fas fa-envelope"></i>
  </span>
  <span class="icon is-right">
    <i class="fas fa-check"></i>
  </span>
</div>
<div class="control has-icons-left has-icons-right">
  <input class="input is-large" type="email" placeholder="Email" />
  <span class="icon is-medium is-left">
    <i class="fas fa-envelope"></i>
  </span>
  <span class="icon is-medium is-right">
    <i class="fas fa-check"></i>
  </span>
</div>

Sass and CSS variables #

Sass Variable
CSS Variable
Value
$input-h
var(--bulma-input-h)
var(--bulma-scheme-h)
$input-s
var(--bulma-input-s)
var(--bulma-scheme-s)
$input-l
var(--bulma-input-l)
var(--bulma-scheme-main-l)
$input-border-l
var(--bulma-input-border-l)
var(--bulma-border-l)
$input-border-l-delta
var(--bulma-input-border-l-delta)
0%
$input-hover-border-l-delta
var(--bulma-input-hover-border-l-delta)
var(--bulma-hover-border-l-delta)
$input-active-border-l-delta
var(--bulma-input-active-border-l-delta)
var(--bulma-active-border-l-delta)
$input-color-l
var(--bulma-input-color-l)
var(--bulma-text-strong-l)
$input-background-l
var(--bulma-input-background-l)
var(--bulma-scheme-main-l)
$input-background-l-delta
var(--bulma-input-background-l-delta)
0%
$input-height
var(--bulma-input-height)
var(--bulma-control-height)
$input-shadow
var(--bulma-input-shadow)
inset 0 0.0625em 0.125em hsla(
  var(--bulma-scheme-h),
  var(--bulma-scheme-s),
  var(--bulma-scheme-invert-l),
  0.05
)
$input-placeholder-color
var(--bulma-input-placeholder-color)
hsla(
  var(--bulma-text-h),
  var(--bulma-text-s),
  var(--bulma-text-strong-l),
  0.3
)
$input-focus-h
var(--bulma-input-focus-h)
var(--bulma-focus-h)
$input-focus-s
var(--bulma-input-focus-s)
var(--bulma-focus-s)
$input-focus-l
var(--bulma-input-focus-l)
var(--bulma-focus-l)
$input-focus-shadow-size
var(--bulma-input-focus-shadow-size)
var(--bulma-focus-shadow-size)
$input-focus-shadow-alpha
var(--bulma-input-focus-shadow-alpha)
var(--bulma-focus-shadow-alpha)
$input-disabled-color
var(--bulma-input-disabled-color)
var(--bulma-text-weak)
$input-disabled-background-color
var(--bulma-input-disabled-background-color)
var(--bulma-background)
$input-disabled-border-color
var(--bulma-input-disabled-border-color)
var(--bulma-background)
$input-disabled-placeholder-color
var(--bulma-input-disabled-placeholder-color)
hsla(
  var(--bulma-text-h),
  var(--bulma-text-s),
  var(--bulma-text-weak-l),
  0.3
)
$input-arrow
var(--bulma-input-arrow)
var(--bulma-link)
$input-icon-color
var(--bulma-input-icon-color)
var(--bulma-text-light)
$input-icon-hover-color
var(--bulma-input-icon-hover-color)
var(--bulma-text-weak)
$input-icon-focus-color
var(--bulma-input-icon-focus-color)
var(--bulma-link)
$input-radius
var(--bulma-input-radius)
var(--bulma-radius)

How to support Bulma

#native_company# #native_desc#
#native_cta#
Get started for Free
Get started for Free