Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@commercetools-uikit/text-input

Package Overview
Dependencies
Maintainers
3
Versions
926
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools-uikit/text-input

A controlled text input component for single-line strings with validation states.

  • 0.0.0-canary-202081093258
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

TextInput

Description

A controlled text input component for single-line strings with validation states.

Installation

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

Usage

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;

Properties

PropsTypeRequiredDefaultDescription
idstringUsed as HTML id property. An id is auto-generated when it is not specified.
autoCompletestringUsed as HTML autocomplete property
classNamestring
namestringUsed as HTML name of the input component. property
valuestringValue of the input component.
onChangecustomCalled with an event containing the new value. Required when input is not read only. Parent should pass it back as value.
Signature: (event) => void
onBlurfuncCalled when input is blurred Signature: (event) => void
onFocusfuncCalled when input is focused Signature: (event) => void
isAutofocussedboolFocus the input on initial render
isDisabledboolIndicates that the input cannot be modified (e.g not authorized, or changes currently saving).
isReadOnlyboolIndicates that the field is displaying read-only content
hasErrorboolIndicates if the input has invalid values
hasWarningbool
placeholderstringPlaceholder text for the input
horizontalConstraintenum
Possible values:
's' | 'm' | 'l' | 'xl' | 'scale'
'scale'Horizontal size limit of the input fields.

data-* props

The component further forwards all data- attributes to the underlying input component.

Static methods

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

Main Functions and use cases are:

  • Input field for single-line strings

FAQs

Package last updated on 10 Sep 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc