Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@commercetools-uikit/text-input
Advanced tools
A controlled text input component for single-line strings with validation states.
A controlled text input component for single-line strings with validation states.
yarn add @commercetools-uikit/text-input
npm --save install @commercetools-uikit/text-input
Additionally install the peer dependencies (if not present)
yarn add react
npm --save install react
import React from 'react';
import TextInput from '@commercetools-uikit/text-input';
const Example = () => (
<TextInput value="foo" onChange={(event) => alert(event.target.value)} />
);
export default Example;
Props | Type | Required | Default | Description |
---|---|---|---|---|
id | string | Used as HTML id property. An id is auto-generated when it is not specified. | ||
autoComplete | string | Used as HTML autocomplete property | ||
className | string | |||
name | string | Used as HTML name of the input component. property | ||
value | string | ✅ | Value of the input component. | |
onChange | custom | Called with an event containing the new value. Required when input is not read only. Parent should pass it back as value. Signature: (event) => void | ||
onBlur | func | Called when input is blurred Signature: (event) => void | ||
onFocus | func | Called when input is focused Signature: (event) => void | ||
isAutofocussed | bool | Focus the input on initial render | ||
isDisabled | bool | Indicates that the input cannot be modified (e.g not authorized, or changes currently saving). | ||
isReadOnly | bool | Indicates that the field is displaying read-only content | ||
hasError | bool | Indicates if the input has invalid values | ||
hasWarning | bool | |||
placeholder | string | Placeholder text for the input | ||
horizontalConstraint | enum Possible values: 's' | 'm' | 'l' | 'xl' | 'scale' | 'scale' | Horizontal size limit of the input fields. |
data-*
propsThe component further forwards all data-
attributes to the underlying input
component.
TextInput.isEmpty
Returns true
when the value is considered empty, which is when the value is empty or consists of spaces only.
TextInput.isEmpty(''); // -> true
TextInput.isEmpty(' '); // -> true
TextInput.isEmpty('tree'); // -> false
FAQs
A controlled text input component for single-line strings with validation states.
The npm package @commercetools-uikit/text-input receives a total of 5,975 weekly downloads. As such, @commercetools-uikit/text-input popularity was classified as popular.
We found that @commercetools-uikit/text-input demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.