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.4
Install (React)npm install @nylas/react
Import (React)import { InputComponent } from '@nylas/react';
Import (CDN)<script type="module"> import { defineCustomElement } from "https://cdn.jsdelivr.net/npm/@nylas/web-elements@latest/dist/cdn/input-component/input-component.es.js"; defineCustomElement(); </script>

Properties

PropertyAttributeDescriptionTypeDefault
autoFocusWhether 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
defaultValueThe default value of the input. This is the value that is displayed when the input is rendered.string | undefinedundefined
labelThe label of the input. This is displayed above the input.string''
maxLengthThe maximum length of the input value. If the value is longer than the maximum length, an error message is displayed. Default is 255.number255
nameThe 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
patternErrorThe error message to display when the value does not match the pattern. Default is ‘Invalid <field> format.’ where <field> is the input label.string''
placeholderThe placeholder of the input. This is displayed when the input is empty.stringDefaultPlaceholder[this.type]
readOnlyWhether the input is read-only. If true, the input cannot be edited. Default is false.booleanfalse
requiredWhether 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
requiredErrorThis error message is displayed when the input value is empty and the input is required.string''
typeThe 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