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

@commercetools-uikit/search-text-input

Package Overview
Dependencies
Maintainers
3
Versions
364
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools-uikit/search-text-input

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

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

Version published
Weekly downloads
1.1K
decreased by-67.15%
Maintainers
3
Weekly downloads
 
Created
Source

SearchTextInput

Description

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

Installation

yarn add @commercetools-uikit/search-text-input
npm --save install @commercetools-uikit/search-text-input

Additionally install the peer dependencies (if not present)

yarn add react
npm --save install react

Usage

import SearchTextInput from '@commercetools-uikit/search-text-input';

const Example = () => (
  <SearchTextInput
    value="foo"
    onChange={(event) => alert(event.target.value)}
    onSubmit={(val) => alert(val)}
    onReset={() => alert('reset')}
  />
);

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
aria-invalidbooleanIndicate if the value entered in the input is invalid.
aria-errormessagestringHTML ID of an element containing an error message related to the input.
namestringUsed as HTML name of the input component property.
valuestringValue of the input component.
onChangeChangeEventHandlerCalled with an event containing the new value. Required when input is not read only. Parent should pass it back as value.
onBlurFocusEventHandlerCalled when input is blurred
onFocusFocusEventHandlerCalled when input is focused
onSubmitFunction
See signature.
Handler when the search button is clicked.
onResetFunction
See signature.
Handler when the clear button is clicked.
isAutofocussedbooleanFocus the input on initial render
isDisabledbooleanIndicates that the input cannot be modified (e.g not authorized, or changes currently saving).
isReadOnlybooleanIndicates that the field is displaying read-only content
hasErrorbooleanIndicates if the input has invalid values
hasWarningbooleanIndicates if the input has warning values
placeholderstringPlaceholder text for the input
isClearablebooleantrueIndicates if the input should be cleared when the clear button is clicked. Defaults to true.
horizontalConstraintunion
Possible values:
, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'
'scale'Horizontal size limit of the input fields.

Signatures

Signature onSubmit

(searchValue: string) => void

Signature onReset

() => void

data-* props

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

Static methods

SearchTextInput.isEmpty

Returns true when the value is considered empty, which is when the value is empty or consists of spaces only.

SearchTextInput.isEmpty(''); // -> true
SearchTextInput.isEmpty(' '); // -> true
SearchTextInput.isEmpty('tree'); // -> false

Main Functions and use cases are:

  • Input field for single-line strings. Used for search.

Keywords

FAQs

Package last updated on 16 Mar 2023

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