<div
  x-data="input"
  class="flex flex-1 items-center rounded-sm border px-3 py-2 outline-hidden transition-shadow duration-200 focus-within:ring-3 focus:outline-hidden"
  class-default="border-gray-300 bg-white focus-within:border-gray-400 focus-within:ring-primary-200 dark:border-dark-600 dark:bg-dark-800 dark:text-text-300 dark:focus-within:ring-primary-300"
  class-valid="border-success-300 bg-white text-success-600 focus-within:ring-success-200 dark:border-success-400 dark:bg-dark-800 dark:text-success-600 dark:focus-within:ring-success-300"
  class-invalid="border-danger-300 bg-white text-danger-600 focus-within:ring-danger-200 dark:border-danger-400 dark:bg-dark-800 dark:text-danger-600 dark:focus-within:ring-danger-300"
>
  <div data-icon class="mr-3 empty:hidden"></div>
  <div data-prepend class="mr-3 empty:hidden"></div>
  <div class="mr-3 flex flex-1 flex-wrap">
    <input
      x-bind="input"
      type="text"
      class="w-full min-w-0 flex-1 border-0 bg-transparent p-0 outline-hidden focus:min-w-[64px] focus:outline-hidden"
    />
  </div>
  <div data-append class="mr-3 empty:hidden"></div>
  <div class="flex items-center gap-x-2">
    <div x-bind="loader" x-cloak>
      <svg
        viewBox="25 25 50 50"
        fill="none"
        class="h-5 w-5 animate-spinner-rotate"
      >
        <circle
          cx="50"
          cy="50"
          r="20"
          stroke="currentColor"
          stroke-width="4"
          stroke-miterlimit="10"
          stroke-linecap="round"
          class="animate-spinner-dash"
        />
      </svg>
    </div>
    <button x-bind="clearButton" @click="clear()" class="flex items-center" x-cloak>
      <svg
        xmlns="http://www.w3.org/2000/svg"
        width="16"
        height="16"
        fill="currentColor"
        class="h-5 w-5 opacity-70"
        viewBox="0 0 16 16"
      >
        <path
          d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"
        />
      </svg>
    </button>
  </div>
</div>
<script defer src="https://cdn.jsdelivr.net/npm/litewind-alpine@0.x.x/components/input/dist/cdn.min.js"></script>
The data for the component is provided by the input function in the x-data directive and the props in the data-* attributes.
          data-clearable
        
        
            false
          
            Boolean
          Adds an X button that resets model to the default value.
data-use-loader
false
Boolean
Enable or disable the spinner in the input.
data-is-loading
false
Boolean
If true displays a spinner in the input. Spinner should be first enabled in the data-use-loader prop.
data-placeholder
empty string
String
Sets the placeholder of the input element.
The input includes several additional elements and props for common features like icons and clear buttons. Below is a complete example with all options enabled. Elements for icons, prepended and appended content are marked using the appropriate data-* attributes.
If you want to hide these elements initially and then show them based on the state of the input element add the group class to the main element, and use group-* variants to style target element. See the Tailwind documentation for details.
<div
  x-data="input"
  data-clearable="true"
  data-use-loader="true"
  data-is-loading="true"
  class="flex flex-1 items-center rounded-sm border px-3 py-2 outline-hidden transition-shadow duration-200 focus-within:ring-3 focus:outline-hidden"
  class-default="border-gray-300 bg-white text-text-600 focus-within:border-gray-400 focus-within:ring-primary-200 dark:border-dark-600 dark:bg-dark-800 dark:text-text-300 dark:focus-within:ring-primary-300"
  class-valid="border-success-300 bg-white text-success-600 focus-within:ring-success-200 dark:border-success-400 dark:bg-dark-800 dark:text-success-600 dark:focus-within:ring-success-300"
  class-invalid="border-danger-300 bg-white text-danger-600 focus-within:ring-danger-200 dark:border-danger-400 dark:bg-dark-800 dark:text-danger-600 dark:focus-within:ring-danger-300"
>
  <div data-icon class="mr-3 empty:hidden">
    <svg
      xmlns="http://www.w3.org/2000/svg"
      fill="currentColor"
      class="h-5 w-5"
      viewBox="0 0 16 16"
    >
      <path
        d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z"
      />
    </svg>
  </div>
  <div data-prepend class="mr-3 empty:hidden">prepend</div>
  <div class="mr-3 flex flex-1 flex-wrap">
    <input
      x-bind="input"
      type="text"
      class="w-full min-w-0 flex-1 border-0 bg-transparent p-0 outline-hidden focus:min-w-[64px] focus:outline-hidden"
    />
  </div>
  <div data-append class="mr-3 empty:hidden">append</div>
  <div class="flex items-center gap-x-2">
    <div x-bind="loader" x-cloak>
      <svg
        viewBox="25 25 50 50"
        fill="none"
        class="h-5 w-5 animate-spinner-rotate"
      >
        <circle
          cx="50"
          cy="50"
          r="20"
          stroke="currentColor"
          stroke-width="4"
          stroke-miterlimit="10"
          stroke-linecap="round"
          class="animate-spinner-dash"
        />
      </svg>
    </div>
    <button x-bind="clearButton" @click="clear()" class="flex items-center" x-cloak>
      <svg
        xmlns="http://www.w3.org/2000/svg"
        width="16"
        height="16"
        fill="currentColor"
        class="h-5 w-5 opacity-70"
        viewBox="0 0 16 16"
      >
        <path
          d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"
        />
      </svg>
    </button>
  </div>
</div>
For the different input styles check the following examples.
<div
  x-data="input"
  class="flex flex-1 items-center border-0 border-b-2 bg-transparent px-0.5 px-3 py-2 focus-within:ring-0"
  class-default="border-secondary-400 dark:border-dark-400 dark:text-text-300"
  class-valid="border-success-300 text-success-600 dark:border-success-400 dark:text-success-600"
  class-invalid="border-danger-300 text-danger-600 dark:border-danger-400 dark:text-danger-600"
>
  <div data-icon class="mr-3 empty:hidden"></div>
  <div data-prepend class="mr-3 empty:hidden"></div>
  <div class="mr-3 flex flex-1 flex-wrap">
    <input
      x-bind="input"
      type="text"
      class="w-full min-w-0 flex-1 border-0 bg-transparent p-0 outline-hidden focus:min-w-[64px] focus:outline-hidden"
    />
  </div>
  <div data-append class="mr-3 empty:hidden"></div>
  <div class="flex items-center gap-x-2">
    <div x-bind="loader" x-cloak>
      <svg
        viewBox="25 25 50 50"
        fill="none"
        class="h-5 w-5 animate-spinner-rotate"
      >
        <circle
          cx="50"
          cy="50"
          r="20"
          stroke="currentColor"
          stroke-width="4"
          stroke-miterlimit="10"
          stroke-linecap="round"
          class="animate-spinner-dash"
        />
      </svg>
    </div>
    <button x-bind="clearButton" @click="clear()" class="flex items-center" x-cloak>
      <svg
        xmlns="http://www.w3.org/2000/svg"
        width="16"
        height="16"
        fill="currentColor"
        class="h-5 w-5 opacity-70"
        viewBox="0 0 16 16"
      >
        <path
          d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"
        />
      </svg>
    </button>
  </div>
</div>