7.0.1 • Published 2 years ago

@paprika/input v7.0.1

Weekly downloads
5,739
License
MIT
Repository
github
Last release
2 years ago

@paprika/input

Description

The Input component is a standard text input with some enhancements that can be used as a controlled or uncontrolled component.

Installation

yarn add @paprika/input

or with npm:

npm install @paprika/input

Props

Input

PropTyperequireddefaultDescription
a11yTextstringfalsenullProvides a non-visible label for this input for assistive technologies.
childrennodefalsenullOptional Input.Container to collect props for root DOM element.
clearIconnodefalsenullCustom icon for the clear action in the input.
defaultValuestringfalsenullSets the default input value for an uncontrolled component.
hasClearButtonboolfalsefalseIf true displays a clear button inside the input if it contains a value.
hasErrorboolfalsefalseIf true displays a red border around input to show error.
iconnodefalsenullDisplays an icon inside the input.
isDisabledboolfalsefalseIf true it makes the input disabled.
isReadOnlyboolfalsefalseIf true it makes the input read only.
onChangefuncfalse() => {}Callback to be executed when the input value is changed. Receives the onChange event as an argument, except when the clear button is clicked, then the argument is null. Required when value prop is provided (component is controlled).
size Input.types.size.SMALL, Input.types.size.MEDIUM, Input.types.size.LARGEfalseInput.types.size.MEDIUMChanges the size of the input.
type Input.types.type.EMAIL, Input.types.type.PASSWORD, Input.types.type.SEARCH, Input.types.type.TELEPHONE, Input.types.type.TEXT, Input.types.type.URLfalseInput.types.type.TEXTAllows user to specify the type of input.
valuestringfalseundefinedThe value inside of the input
hasCSSResetboolfalsefalseIf true all: unset; will be applied

Input.Container

All props and attributes are spread onto the root container <div> element.

Usage

The <Input> can be used as a controlled or an uncontrolled component.

To use it as controlled:

import Input from "@paprika/input";
...
const [value, setValue] = React.useState("default value");
...
<Input
  value={value}
  onChange={event => {
    setValue(event ? event.target.value : "");
  }}
/>

To use it as an uncontrolled component:

import Input from "@paprika/input";
...
const refInput = React.useRef();
...
<Input
  defaultValue="default value"
  ref={refInput}
/>
...
refInput.current.value // latest value

Dependencies

The <L10n> component is a required context provider when the hasClearButton prop is provided. It should wrap the <Input> (or your application) for localization of the clear button's ARIA label.

Links

7.0.1

2 years ago

7.0.1-next.0

2 years ago

7.0.0-next.0

2 years ago

7.0.0

2 years ago

6.0.1-next.0

2 years ago

6.0.1

2 years ago

6.0.0

2 years ago

6.0.0-next.0

2 years ago

5.0.3-next.0

3 years ago

5.0.3

3 years ago

5.0.2

3 years ago

5.0.1

3 years ago

5.0.2-next.0

3 years ago

5.0.0

3 years ago

5.0.1-next.0

3 years ago

5.0.0-next.1

3 years ago

4.1.0-next.0

3 years ago

4.0.19-next.1

3 years ago

4.0.19-next.0

3 years ago

4.0.19

3 years ago

4.0.20

3 years ago

4.0.20-next.0

3 years ago

4.1.0

3 years ago

4.0.18-next.0

3 years ago

4.0.18-next.2

3 years ago

4.0.18-next.1

3 years ago

4.0.18

3 years ago

4.0.17-next.0

4 years ago

4.0.17-next.1

4 years ago

4.0.17

4 years ago

4.0.16-next.0

4 years ago

4.0.15-next.0

4 years ago

4.0.14-next.0

4 years ago

4.0.15-next.1

4 years ago

4.0.15-next.4

4 years ago

4.0.15-next.2

4 years ago

4.0.15-next.3

4 years ago

4.0.16

4 years ago

4.0.15

4 years ago

4.0.14

4 years ago

4.0.13-next.0

4 years ago

4.0.12-next.0

4 years ago

4.0.12

4 years ago

4.0.13

4 years ago

4.0.11

4 years ago

4.0.11-next.0

4 years ago

4.0.10-next.0

4 years ago

4.0.10

4 years ago

4.0.9

4 years ago

4.0.9-next.0

4 years ago

4.0.8

4 years ago

4.0.8-next.0

4 years ago

4.0.7-next.0

4 years ago

4.0.7

4 years ago

4.0.6-next.0

4 years ago

4.0.6

4 years ago

4.0.5

4 years ago

4.0.5-next.0

4 years ago

4.0.4

4 years ago

4.0.4-next.0

4 years ago

4.0.3

4 years ago

4.0.3-next.0

4 years ago

4.0.2

4 years ago

4.0.2-next.0

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.1

4 years ago

4.0.0-next.0

4 years ago

4.0.1-next.0

4 years ago

3.0.1-next.0

4 years ago

3.0.1-next.1

4 years ago

3.0.0

4 years ago

2.0.1-alpha.2

4 years ago

2.0.1-alpha.0

4 years ago

2.0.1-alpha.1

4 years ago

2.0.0

4 years ago

1.0.7-alpha.0

4 years ago

1.0.6-alpha.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.5-alpha.0

4 years ago

1.0.4

4 years ago

1.0.4-alpha.0

5 years ago

1.0.3

5 years ago

1.0.3-alpha.1

5 years ago

1.0.3-alpha.0

5 years ago

1.0.2

5 years ago

1.0.2-alpha.1

5 years ago

1.0.2-alpha.0

5 years ago

1.0.1

5 years ago

1.0.1-alpha.1

5 years ago

1.0.1-alpha.0

5 years ago

1.0.0

5 years ago

0.3.11

5 years ago

0.3.11-alpha.4

5 years ago

0.3.11-alpha.3

5 years ago

0.3.11-alpha.2

5 years ago

0.3.11-alpha.1

5 years ago

0.3.11-alpha.0

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.38

5 years ago

0.2.37

5 years ago

0.2.36

5 years ago

0.2.35

5 years ago

0.2.34

5 years ago

0.2.33

5 years ago

0.2.32

5 years ago

0.2.31

5 years ago

0.2.30

5 years ago

0.2.29

5 years ago

0.2.28

5 years ago

0.2.27

5 years ago

0.2.26

5 years ago

0.2.25

5 years ago

0.2.24

5 years ago

0.2.23

5 years ago

0.2.22

5 years ago

0.2.21

5 years ago

0.2.20

5 years ago

0.2.19

5 years ago

0.2.18

5 years ago

0.2.17

5 years ago

0.2.16

5 years ago

0.2.15

5 years ago

0.2.14

5 years ago

0.2.13

5 years ago

0.2.12

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.17

6 years ago

0.1.16

6 years ago

0.1.15

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago