Skip to content
Oruga
Bulma
Bootstrap
Tailwind

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 the functionalities.

Examples ​

Base ​

html
<section>
    <o-field label="Name">
        <o-input model-value="John Silver" />
    </o-field>

    <o-field label="Email" variant="danger" message="This email is invalid">
        <o-input type="email" model-value="john@" :maxlength="30" />
    </o-field>

    <o-field
        label="Username"
        variant="success"
        message="This username is available">
        <o-input model-value="johnsilver" :maxlength="30" />
    </o-field>

    <o-field label="Password">
        <o-input
            type="password"
            model-value="iwantmytreasure"
            password-reveal />
    </o-field>

    <o-field label="Clearable">
        <o-input model-value="John Silver" clearable />
    </o-field>

    <o-field label="Message">
        <o-input
            :maxlength="200"
            type="textarea"
            autosize
            placeholder="Enter some text..." />
    </o-field>

    <o-field>
        <o-input model-value="" placeholder="No label" />
    </o-field>

    <o-field label="Number">
        <o-input
            :model-value="42"
            number
            type="number"
            placeholder="Number"
            rounded />
    </o-field>

    <o-field label="Disabled">
        <o-input placeholder="Disabled" disabled />
    </o-field>

    <o-field label="Expanded">
        <o-input placeholder="Expanded" expanded />
    </o-field>

    <o-field label="Counter">
        <o-input
            placeholder="Counter"
            :maxlength="10"
            :maxitems="5"
            counter />
    </o-field>
</section>

Variants ​

Different styles can be achieved with the variant prop.

html
<section>
    <o-field label="Primary" variant="primary">
        <o-input placeholder="Primary" />
    </o-field>

    <o-field label="Secondary" variant="secondary">
        <o-input placeholder="Secondary" />
    </o-field>

    <o-field label="Success" variant="success">
        <o-input placeholder="Success" />
    </o-field>

    <o-field label="Info" variant="info">
        <o-input placeholder="Info" />
    </o-field>

    <o-field label="Warning" variant="warning">
        <o-input placeholder="Warning" />
    </o-field>

    <o-field
        label="Error"
        variant="danger"
        message="You can have a message too">
        <o-input placeholder="Error" />
    </o-field>
</section>

Sizes ​

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

html
<section>
    <o-field>
        <o-input placeholder="small" size="small" icon="user" />
    </o-field>

    <o-field>
        <o-input placeholder="default" icon="user" />
    </o-field>

    <o-field>
        <o-input placeholder="medium" size="medium" icon="user" />
    </o-field>

    <o-field>
        <o-input placeholder="Large" size="large" icon="user" />
    </o-field>
</section>

With Icons ​

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

html
<section>
    <o-field>
        <o-input
            placeholder="Search..."
            type="search"
            icon="search"
            icon-clickable
            @icon-click="searchIconClick" />
    </o-field>

    <o-field>
        <o-input
            placeholder="Search..."
            type="search"
            icon-right="search"
            icon-right-clickable />
    </o-field>

    <o-field>
        <o-input
            v-model="email"
            placeholder="Email"
            type="email"
            icon="envelope"
            icon-right="times-circle"
            icon-right-clickable
            @icon-right-click="clearIconClick" />
    </o-field>
</section>
javascript
import { ref } from "vue";

const email = ref("");

function searchIconClick(): void {
    alert("You wanna make a search?");
}

function clearIconClick(): void {
    email.value = "";
    alert("Email cleared!");
}

Input Component ​

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

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

Props ​

Prop nameDescriptionTypeValuesDefault
aria-activedescendantIdentifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.string-
aria-atomicIndicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.Booleanish-
aria-autocompleteIndicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be
presented if they are made.
"both" | "inline" | "list" | "none"-
aria-busyIndicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user.Booleanish-
aria-checkedIndicates the current "checked" state of checkboxes, radio buttons, and other widgets."mixed" | Booleanish-
aria-colcountDefines the total number of columns in a table, grid, or treegrid.Numberish-
aria-colindexDefines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.Numberish-
aria-colspanDefines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.Numberish-
aria-controlsIdentifies the element (or elements) whose contents or presence are controlled by the current element.string-
aria-currentIndicates the element that represents the current item within a container or set of related elements."date" | "location" | "page" | "step" | "time" | Booleanish-
aria-describedbyIdentifies the element (or elements) that describes the object.string-
aria-detailsIdentifies the element that provides a detailed, extended description for the object.string-
aria-disabledIndicates that the element is perceivable but disabled, so it is not editable or otherwise operable.Booleanish-
aria-dropeffect
deprecated - in ARIA 1.1
Indicates what functions can be performed when a dragged object is released on the drop target.
"copy" | "execute" | "link" | "move" | "none" | "popup"-
aria-errormessageIdentifies the element that provides an error message for the object.string-
aria-expandedIndicates whether the element, or another grouping element it controls, is currently expanded or collapsed.Booleanish-
aria-flowtoIdentifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,
allows assistive technology to override the general default of reading in document source order.
string-
aria-grabbed
deprecated - in ARIA 1.1
Indicates an element's "grabbed" state in a drag-and-drop operation.
Booleanish-
aria-haspopupIndicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element."dialog" | "grid" | "listbox" | "menu" | "tree" | Booleanish-
aria-hiddenIndicates whether the element is exposed to an accessibility API.Booleanish-
aria-invalidIndicates the entered value does not conform to the format expected by the application."grammar" | "spelling" | Booleanish-
aria-keyshortcutsIndicates keyboard shortcuts that an author has implemented to activate or give focus to an element.string-
aria-labelDefines a string value that labels the current element.string-
aria-labelledbyIdentifies the element (or elements) that labels the current element.string-
aria-levelDefines the hierarchical level of an element within a structure.Numberish-
aria-liveIndicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region."assertive" | "off" | "polite"-
aria-modalIndicates whether an element is modal when displayed.Booleanish-
aria-multilineIndicates whether a text box accepts multiple lines of input or only a single line.Booleanish-
aria-multiselectableIndicates that the user may select more than one item from the current selectable descendants.Booleanish-
aria-orientationIndicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous."horizontal" | "vertical"-
aria-ownsIdentifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship
between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
string-
aria-placeholderDefines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.
A hint could be a sample value or a brief description of the expected format.
string-
aria-posinsetDefines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.Numberish-
aria-pressedIndicates the current "pressed" state of toggle buttons."mixed" | Booleanish-
aria-readonlyIndicates that the element is not editable, but is otherwise operable.Booleanish-
aria-relevantIndicates what notifications the user agent will trigger when the accessibility tree within a live region is modified."additions removals" | "additions text" | "additions" | "all" | "removals additions" | "removals text" | "removals" | "text additions" | "text removals" | "text"-
aria-requiredIndicates that user input is required on the element before a form may be submitted.Booleanish-
aria-roledescriptionDefines a human-readable, author-localized description for the role of an element.string-
aria-rowcountDefines the total number of rows in a table, grid, or treegrid.Numberish-
aria-rowindexDefines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.Numberish-
aria-rowspanDefines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.Numberish-
aria-selectedIndicates the current "selected" state of various widgets.Booleanish-
aria-setsizeDefines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.Numberish-
aria-sortIndicates if items in a table or grid are sorted in ascending or descending order."ascending" | "descending" | "none" | "other"-
aria-valuemaxDefines the maximum allowed value for a range widget.Numberish-
aria-valueminDefines the minimum allowed value for a range widget.Numberish-
aria-valuenowDefines the current value for a range widget.Numberish-
aria-valuetextDefines the human readable text alternative of aria-valuenow for a range widget.string-
autocapitalizeSame as native autocapitalizestring-
autocompleteNative options to use in HTML5 validation,
whether the value of the form's controls can be automatically completed by the browser.
string-
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
}
colsSame as native cols (textarea only)Numberish-
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: InputType<IsNumber> | null , state: ValidityState) => string) | undefined-""
debounceNumber of milliseconds to delay before emitting the valuenumber-
From config:
autocomplete: {
  debounce: undefined
}
disabledSame as native disabledboolean-false
enterkeyhintSame as native enterkeyhint"done" | "enter" | "go" | "next" | "previous" | "search" | "send"-
expandedMakes input full width when inside a grouped or addon fieldboolean-
From config:
input: {
  expanded: false
}
formSame as native formstring-
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 pass the id to a wrapping o-field component. Default is a uuid.string-useId()
inputmodeSame as native inputmode"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url"-
listSame as native liststring-
maxSame as native maxNumberish-
maxlengthSame as native maxlength. Also used to show character counter when counter prop is enabled.number | string-
minSame as native minNumberish-
minlengthSame as native minlengthNumberish-
modelModifiersPartial<Record<string, true>>-
v-modelThe input value state, use v-model to make it two-way bindingnumber | string-
nameSame as native namestring-
numberConvert the ´modelValueinto typenumber`boolean-
overrideOverride existing theme classes completelyboolean-
passwordRevealAdds the reveal password functionalityboolean-false
patternSame as native patternstring-
placeholderSame as native placeholderstring-
readonlySame as native readonlyBooleanish-
requiredSame as native requiredBooleanish-
roundedMakes the element roundedboolean-false
rowsSame as native rows (textarea only)Numberish-
sizeSize of the controlstringsmall, medium, large
From config:
input: {
  size: undefined
}
spellcheckSame as native spellcheckBooleanish-
statusIconShow status icon using field and variant propboolean-
From config:
{
  statusIcon: true
}
stepSame as native stepNumberish-
titleSame as native titlestring-
translateSame as native translate"no" | "yes"-
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
}
wrapSame as native wrap (textarea only)string-

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-background-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

Current theme ➜ Tailwind

SASS VariableDefault

See ➜ 📄 SCSS file

Released under the MIT License.