Skip to content

Input

The Input component uses HTML's native text input. It allows a user to enter a single line of text. Combine it with the Field component to access all functionalities.

Examples

Base

Variants

Different styles can be achieved with the variant prop.

Sizes

The component can be displayed in different sizes using the size prop.

With Icons

Add an icon to the component to explain its function more visually.

Input Component

Get user Input. Use with Field to access all functionalities.

html
<o-input></o-input>

Props

Prop nameDescriptionTypeValuesDefault
autocompleteNative options to use in HTML5 validationstring-
From config:
input: {
  autocomplete: "off"
}
autosizeAutomatically adjust height in textareaboolean-false
clearIconIcon name to be added on the clear buttonstring-
From config:
input: {
  clearIcon: "close-circle"
}
clearableAdd a button/icon to clear the inputed textboolean-
From config:
input: {
  clearable: false
}
counterShow character counter when maxlength prop is passedboolean-
From config:
input: {
  counter: false
}
customValidityCustom HTML 5 validation error to set on the form controlstring | ((currentValue: string | number | null , state: ValidityState) => string) | undefined-""
debounceNumber of milliseconds to delay before to emit input eventnumber-
From config:
autocomplete: {
  debounce: 400
}
disabledSame as native disabledboolean-false
expandedMakes input full width when inside a grouped or addon fieldboolean-
From config:
input: {
  expanded: false
}
iconIcon to be shownstring-
From config:
input: {
  icon: undefined
}
iconClickableMakes the icon clickableboolean-false
iconPackIcon pack to usestringmdi, fa, fas and any other custom icon pack
From config:
input: {
  iconPack: undefined
}
iconRightIcon to be added on the right sidestring-
From config:
input: {
  iconRight: undefined
}
iconRightClickableMake the icon right clickableboolean-false
iconRightVariantVariant of right iconstring-
idSame as native id. Also set the for label for o-field wrapper - default is an uuid.string-useId()
maxlengthSame as native maxlength, plus character counternumber | string-
modelModifiersPartial<Record<string, true>>-
v-modelThe input value statenumber | string-
numberConvert the ´modelValueinto typenumber`boolean-
overrideOverride existing theme classes completelyboolean-
passwordRevealAdds the reveal password functionalityboolean-false
placeholderInput placeholderstring-
roundedMakes the element roundedboolean-false
sizeSize of the controlstringsmall, medium, large
From config:
input: {
  size: undefined
}
statusIconShow status icon using field and variant propboolean-
From config:
{
  statusIcon: true
}
typeInput type, like nativestringAny native input type, and textarea"text"
useHtml5ValidationEnable HTML 5 native validationboolean-
From config:
{
  useHtml5Validation: true
}
variantColor variant of the controlstringprimary, info, success, warning, danger, and any other custom color
From config:
input: {
  variant: undefined
}

Events

Event namePropertiesDescription
update:model-valuevalue string | number - updated modelValue propmodelValue prop two-way binding
inputvalue string - input value
event Event - native event
on input change event
focusevent Event - native eventon input focus event
blurevent Event - native eventon input blur event
invalidevent Event - native eventon input invalid event
icon-clickevent Event - native eventon icon click event
icon-right-clickevent Event - native eventon icon right click event

Class Inspector

Classes applied to the element:
Want to know how does the Class Inspector work?
Class propDescriptionPropsSuffixes
rootClass
Class of the root element.
sizeClass
Class of the root element with size.
sizesmall
medium
large
variantClass
Class of the root element with variant.
👉 Variant property should be applied to the wrapping field.
variantprimary
info
warning
danger
expandedClass
Class of the root element when expanded.
expanded
disabledClass
Class of the root element when disabled.
disabled
roundedClass
Class of the root element when rounded.
rounded
textareaClass
Class of the root element when type `textarea`.
type
hasIconRightClass
Class to the root element when a right icon is used.
iconRight
inputClass
Class of the native input element.
placeholderClass
Class of the native input element with a placeholder.
iconLeftSpaceClass
Class of the native input element with left icon space.
icon
iconRightSpaceClass
Class of the native input element with right icon space.
iconRight
iconLeftClass
Class of the left icon element.
icon
iconRightClass
Class of the right icon element.
iconRight
counterClass
Class of the counter element.
counter
maxlength

Sass Variables

Current theme ➜ Oruga

SASS VariableDefault
$input-colorh.useVar("font-color")
$input-font-sizeh.useVar("font-size")
$input-font-weighth.useVar("font-weight")
$input-line-heighth.useVar("line-height")
$input-heighth.useVar("control-height")
$input-paddingh.useVar("control-padding-vertical") h.useVar("control-padding-horizontal")
$input-disabled-opacityh.useVar("control-disabled-opacity")
$input-box-shadowh.useVar("control-box-shadow-inset")
$input-border-widthh.useVar("control-border-width")
$input-border-stylesolid
$input-border-colorh.useVar("control-border-color")
$input-border-radiush.useVar("border-radius")
$input-border-radius-roundedh.useVar("border-radius-rounded")
$input-background-colorh.useVar("control-brackground-color")
$input-textarea-min-height120px
$input-textarea-max-height600px
$input-textarea-paddingh.useVar("control-spacer")
$input-counter-font-size0.75rem
$input-counter-padding0.25rem 0.5rem

See ➜ 📄 SCSS file

Current theme ➜ Bulma

SASS VariableDefault
$input-colorsdv.$colors

See ➜ 📄 SCSS file

Current theme ➜ Bootstrap

SASS VariableDefault
$input-icon-color$input-color
$input-icon-spacer0.75rem
$input-icon-padding-sm2rem
$input-icon-padding2.5rem
$input-icon-padding-lg3rem

See ➜ 📄 SCSS file

Released under the MIT License.