Form Components

input-component

Overview

The input-component component is a UI component that allows users to input text, email, or phone number values. This component is used in the scheduling form to input text, email and phone number type inputs.

Version1.1.0
Install (React)npm install @nylas/react
Import (React)import { InputComponent } from '@nylas/react';

Properties

PropertyAttributeDescriptionTypeDefault
autoFocusauto-focusWhether the input should be focused when rendered. Default is false. If true, the input is focused when rendered. Use this to set the focus on the first input in a form.booleanfalse
defaultValuedefault-valueThe default value of the input. This is the value that is displayed when the input is rendered.string | undefinedundefined
labellabelThe label of the input. This is displayed above the input.string''
maxLengthmax-lengthThe maximum length of the input value. If the value is longer than the maximum length, an error message is displayed. Default is 255.number255
namenameThe name of the input. This is used to identify the input when submitting a form.string'input'
patternThe pattern to validate the input value. If the value does not match the pattern, an error message is displayed. Default is null. If the pattern is not set, the pattern is determined by the input type for ‘email’ and ‘phone_number’.RegExp | undefinedundefined
patternErrorpattern-errorThe error message to display when the value does not match the pattern. Default is ‘Invalid <field> format.’ where <field> is the input label.string''
placeholderplaceholderThe placeholder of the input. This is displayed when the input is empty.stringDefaultPlaceholder[this.type]
readOnlyread-onlyWhether the input is read-only. If true, the input cannot be edited. Default is false.booleanfalse
requiredrequiredWhether the input is required. If true, the input must have a value when submitting a form. Default is false. If the input is required and the value is empty, an error message is displayed.booleanfalse
requiredErrorrequired-errorThis error message is displayed when the input value is empty and the input is required.string''
typetypeThe type of the input. This is used to determine the input’s behavior. Supported types are ‘text’, ‘email’, and ‘phone_number’."email" | "phone_number" | "text"'text'

Events

EventDescriptionType
nylasFormInputBlurredCustomEvent<{ value: string; name: string; }>
nylasFormInputChangedThis event is fired when the input value is changed. The scheduling form listens for this event to validate the input value and submit the form. If using outside of the scheduling form, listen for this event to validate the input value and handle the input value change.CustomEvent<{ value: string; name: string; label: string; type: string; error: string; }>
nylasFormInputFocusedCustomEvent<{ value: string; name: string; }>

Shadow Parts

PartDescription
"ic__input"
"ic__input_wrapper"
"ic__label"

Graph


Built with StencilJS