Skip to main content

yInput

Description

The yInput is an element that allows user input. This yInput can be furhter used for example for:

Basic Structure

The basic structure of the yInput shall be explained in the following. For the general structure of a yComponent please visit the YBase-components basic-structure.

Input Structure

The yInput as seen above contains a label and a helper text and includes multiple icons and more.

Label

The label contains the text inside the button. It is on the right side of the component. By changing the inner padding of the button, the label gets moved too. You can find further explanation at the Label Property.

Hint

The Hint is similar to the label and displays a hint related to the input that will be expected. In certain situations the helper text will be replaced by a warning or error text, which can either be set through the automatic validation or custom scripts.

Properties

Through its various properties the yInput can be configured to suit your needs. The display below provides you with an overview of all the yInput properties.

Properties can be changed directly through three methods:

  • Inside the Toolbar, which is positioned in your workarea next to your component right where you need it. It shows the most important properties, thus providing a fast and efficient way to configure your component in the most basic way.
  • It may also occur in the Toolbar Extension, which is a seamless extension accesible as a dropdown item of the Toolbar. It extends the functionality of the Toolbar by providing advanced pickers for the most used properties.
  • Inside the Detail Panel, which is located in the righthand drawer. Every property of a component can be configured here.
METAread more
--y-input__component-id

The identifier of the component that is unique within a page.

--y-input__component-type

The type of the component. For this component it is -input.

--y-input__name

The custom name of the component. It serves for better identification of the component.

--y-input__version

The custom version of the Input-component. This can be used to ensure that all components work well together.

--y-input__core-theme

The CoreTheme, which will be apllied to the Input. For further information on themes visit the themes page.

--y-input__sub-theme

The subtheme subordinated to the previously specified CoreTheme, which will be apllied to the Input. For further information on themes visit the themes page.

--y-input__group-theme

The group theme is a further variation of the subtheme which is specified especially for variations of a component inside the subtheme. For further information on themes visit the Theme-Manager page.

DISPLAYread more
--y-input__display

This property specifies the display behavior of the component. This can be be set to:

  • none
  • block
  • flex
  • inline
--y-input__position

This property specifies the type of positioning method used for the component. This can be be set to:

  • static
  • relative
  • absolute
  • sticky
  • fixed
--y-input__visible

This property can toggle the visibility of the component. The two modes are completely hidden and fully shown.

SIZEread more
--y-input__min-width

The minimum value for the width of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %
--y-input__min-height

The minimum value for the height of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %

The value for the width of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %
  • auto

The value for the height of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %
  • auto
--y-input__max-width

The maximum value for the width of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %
  • none
--y-input__max-height

The maximum value for the height of the component. This can be set in:

  • px
  • pt
  • em
  • vw
  • vh
  • %
  • none
--y-input__flex

The flex property sets the length on flexible items. This sets the value in n-fold shares extrapolated to all other components with the flex display within the same container.

PLACEMENTread more
--y-input__margin-top

This property creates a space around the component, outside of the top border. This can be set in percent or pixels.

--y-input__margin-right

This property creates a space around the component, outside of the right border. This can be set in percent or pixels.

--y-input__margin-bottom

This property creates a space around the component, outside of the bottom border. This can be set in percent or pixels.

--y-input__margin-left

This property creates a space around the component, outside of the left border. This can be set in percent or pixels.

--y-input__padding-top

This property creates a space within the component, inside of the top border. This can be set in percent or pixels.

--y-input__padding-right

This property creates a space within the component, inside of the right border. This can be set in percent or pixels.

--y-input__padding-bottom

This property creates a space within the component, inside of the bottom border. This can be set in percent or pixels.

--y-input__padding-left

This property creates a space within the component, inside of the top border. This can be set in percent or pixels.

Usage

In this section you will find a collection of application scenarios and examples that illustrate how to leverage the yInput in ways that deviate from its standard behavior, as defined by yBase. This section aims to inspire and guide you through various possibilities, helping you to implement more complex or unique functionalities tailored to your specific needs. General properties that are universally applicable can be found in the yBase usage section.

Variations

Input Elevated
Elevated
Input Flat
Flat
Input Outlined
Outlined
Input Rounded
Rounded
Input Plain
Plain
genericsizeminWidth200px
genericsizemaxHeight44px
stylebackgroundbgColor__normal#44ddbb
styleshadowboxShadow__normal0 3px 6px 0 rgba(16, 18, 24, 0.2)
styleborderborderRadius8px
stylelabellabel__fontColor__normal#FFFFFF
stylehinthint
styleindicatorindicator__height0px

Special Variations

Beyond standard configurations, the yInput allows for advanced customization. Tailor the component for specific needs like user feedback forms with character limits or code input areas with monospace font styling.

Input Numeric Context
Numeric Context
Input Textual Context
Textual Context
Input Clean
No Label, Placeholder
Input Prefix Suffix
Prefix & Suffix
Input Prefix Icon
Prefix Icon
genericsizeminWidth200px
genericsizemaxHeight44px
stylelabellabel'Enter amount'
styleplaceholderplaceholder'e.g., 100'
stylecontentvalue'100'
stylehinthint'Numeric values only'
stylecontentcontent__fontAlign'right'
stylebackgroundbgColor__normal#ECEFF1
styleborderborderStyleTop__normalsolid
styleborderborderStyleRight__normalsolid
styleborderborderStyleBottom__normalsolid
styleborderborderStyleLeft__normalsolid
styleborderborderWidthTop__normal2px
styleborderborderWidthRight__normal2px
styleborderborderWidthBottom__normal2px
styleborderborderWidthLeft__normal2px
styleborderborder-colorTop__normal#CFD8DC
styleborderborder-colorRight__normal#CFD8DC
styleborderborder-colorBottom__normal#CFD8DC
styleborderborder-colorLeft__normal#CFD8DC
stylecontenttype'number

Mask and Validation

In the Component > Validation group, you will find the mask and validate properties. mask controls the built-in Maska behavior, and validate allows you to add custom validation to the input.

Using Maska in our input component lets you define input masks as strings, so you can enforce specific formats like phone numbers or birthdays. To define a mask, simply provide a string that represents the desired format. For example, a mask for a German phone number could look like:

+49 (###) ###-####

Here, # acts as a digit placeholder. This ensures that users always enter phone numbers in a consistent format, improving data quality and reducing input errors.

In addition, the component provides a validation picker, accessible via the plus icon in the validation group. There you can:

  • choose a comparator (e.g. equals, not equal, greater than, …)
  • define a value to compare against
  • specify a custom error message

If the validation fails, the error message is shown instead of the usual hint, giving users immediate and clear feedback about what went wrong. This makes your inputs both more robust and more user-friendly, as users are guided toward valid data entry.

Input Validation

Debounce

The Debounce property in the Component > Misc group is a powerful way to improve performance and user experience by controlling how often a function is executed.

When events fire rapidly (for example while typing in a search field or during window resize), debounce adds a delay in milliseconds. The function is only executed after the last event if no new event occurs within that delay. If another event happens before the delay has passed, the timer is reset. This significantly reduces redundant function calls, calculations, and API requests.

How to:

  1. Open the Detail Panel.
  2. Go to Component, expand Misc, and adjust the debounce value.

A common use case is live search: Instead of sending a request on every keystroke, the search is triggered only once the user stops typing for the configured debounce time. This lowers server load and makes the UI feel smoother.

Custom Validation

The yInput can be customized to use a custom validation value for user input and restrict the allowed values, besides using the in-built validation.

How to:

  1. Open the Detail Panel and proceed to Events, unfold Input and modify EvtChanged.
  2. Insert the code down below.

Code example:

The example down below applies a custom validation for input values.

Input EvtChanged
// function onInput_2_EvtChanged (apiObject, component, eventData) {

const userName = eventData.data.trim();

if (userName.length < 3) {
alert("The username must be at least 3 characters long.");
return false;
} else if (/[^a-zA-Z0-9]/.test(userName)) {
alert("The username can only contain alphanumeric characters.");
return false;
}

console.log("Username is valid.");
return true;
//}

Read input text

You can use your browser to speak. Basically you can use the text of an input field, to be read.

How to:

  1. Open the Detail Panel and proceed to Events, unfold Input and modify EvtChanged.
  2. Insert the code down below.

Code example:

The example down below sends the input text to the Speech API and lets the browser read it.

Input EvtChanged
// async function onInput_2_EvtChanged (apiObject, component, eventData) {

const inputText = eventData.data;

await apiObject.speech.loadVoices();

apiObject.speech.speak(inputText);
//}