Skip to main content

CaInputText

Text field, use v-model to bind value

SASS-path: ./styles/components/atoms/ca-input-text.scss

Props

NameDescriptionTypeRequiredDefault
labelThe label of the field, showed as "placeholder" when field empty or not in focusStringfalse-
placeholderThe field placeholder, can be used if not using labelStringfalse-
valueThe value of the field, use v-model to bind dataString / Numbertrue-
descriptionA description text for the fieldStringfalse-
requiredIs the field requierd?Booleanfalsetrue
disabledIs the field disabled?Booleanfalsefalse
autocompleteThe autocomplete attributeStringfalsenull
loadingShow a loading spinner in the fieldBooleanfalsefalse
typeType of fieldStringfalsetext
idId of field, also used as nameStringfalse-
validUsed to handle validation outside input scopeBooleanfalsetrue
errorMessageWhat error text should be displayed if field not vaildStringfalsenull
validateSet to use built in validationemail, passwordStrength, passwordMatch, personalId, emptyfalse-
passwordToMatchThe password to match if using the passwordMatch validationStringfalse-

Events

Event NameDescriptionParameters
inputInput has been madeField value (String/Number)
validationValidation has been madeIs valid (Boolean)

Methods

MethodDescriptionParameters
validateInputValidate input, sets fieldValid and returns bool-
validateEmailUsed by validateInput to validate email addressemail (String)
validatePersonalIdUsed by validateInput to validate Swedish personal ID's (Source: https://gist.github.com/peppelorum/5856691)identityNumber (String)
validateIfErrorValidates field instantly if not valid, used on keyup-
blurHandlerControls what happens on field blur-
togglePasswordVisibleToggle field type for password-

Computed

ComputedTypeDescriptionFrom Store
modifiersObjectAll the modifier classesNo
allValidBooleanIs field valid?No
inputListenersObjectUsed to be a transparent wrapper for the text input, all events will be passed throughNo
inputTypeStringReturns field type, used for toggeling password fieldNo
passwordToggleTextStringReturns text for password field toggleNo