3.0.13 • Published 2 years ago

@paprika/textarea v3.0.13

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

@paprika/textarea

Description

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

Installation

yarn add @paprika/textarea

or with npm:

npm install @paprika/textarea

Props

Textarea

PropTyperequireddefaultDescription
a11yTextstringfalsenullProvides a non-visible label for this textarea for assistive technologies.
canExpandboolfalsetrueIf true the height will expand automatically to fit content up to the value of maxHeight.
childrennodefalsenullOptional Textarea.Container to collect props for root DOM element.
defaultValuestringfalsenullSets the default textarea value for an uncontrolled component.
hasErrorboolfalsefalseIf true displays a red border around textarea to indicate an error.
isDisabledboolfalsefalseIf true it makes the textarea disabled.
isReadOnlyboolfalsefalseIf true it makes the textarea read only.
maxHeightnumber,stringfalse300The maximum height of the textarea.
minHeightnumber,stringfalse80The minimum / default height of the textarea.
onChangefuncfalse() => {}Callback to be executed when the textarea value is changed. Receives the onChange event as an argument. Required when component is controlled.
size Textarea.types.size.SMALL, Textarea.types.size.MEDIUM, Textarea.types.size.LARGEfalseTextarea.types.size.MEDIUMThe size of the textarea input (font size).
valuestringfalseundefinedThe value inside of the textarea input. Defining this prop will make this a controlled component. Do not use in conjunction with defaultValue.

Textarea.Container

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

Usage

The Textarea can be used as a controlled or uncontrolled component.

To use it as a controlled comnponent:

import Textarea from "@paprika/textarea";
...
const [value, setValue] = React.useState("Hello world");
...
<Textarea
  value={value}
  onChange={event => { setValue(event.target.value) }}
/>

To use it as an uncontrolled component:

import Textarea from "@paprika/textarea";
...
const refTextarea = React.useRef();
...
<Textarea
  defaultValue="Hello world"
  ref={refTextarea}
/>
...
refTextarea.current.value // latest value

Links

3.0.12

2 years ago

3.0.13

2 years ago

3.0.12-next.0

2 years ago

3.0.13-next.0

2 years ago

3.0.10

3 years ago

3.0.11

3 years ago

3.0.11-next.0

3 years ago

3.0.10-next.0

3 years ago

3.0.9

3 years ago

3.0.9-next.0

3 years ago

3.0.9-next.1

3 years ago

3.0.8

3 years ago

3.0.8-next.0

3 years ago

3.0.8-next.2

3 years ago

3.0.8-next.1

3 years ago

3.0.7

4 years ago

3.0.7-next.1

4 years ago

3.0.7-next.0

4 years ago

3.0.6

4 years ago

3.0.6-next.1

4 years ago

3.0.6-next.2

4 years ago

3.0.6-next.0

4 years ago

3.0.4-next.0

4 years ago

3.0.4

4 years ago

3.0.5

4 years ago

3.0.5-next.0

4 years ago

3.0.3

4 years ago

3.0.3-next.0

4 years ago

3.0.2

4 years ago

3.0.2-next.0

4 years ago

3.0.1

4 years ago

3.0.1-next.0

4 years ago

3.0.0-next.0

4 years ago

3.0.0

4 years ago

2.0.1

4 years ago

2.0.1-next.0

4 years ago

2.0.0

4 years ago

2.0.0-next.0

4 years ago

1.0.6

4 years ago

1.0.6-alpha.2

4 years ago

1.0.6-alpha.1

4 years ago

1.0.6-alpha.0

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.3

4 years ago

1.0.3-alpha.0

5 years ago

1.0.2

5 years ago

1.0.2-alpha.0

5 years ago

1.0.1

5 years ago

1.0.1-alpha.0

5 years ago

1.0.0

5 years ago

0.3.7

5 years ago

0.3.7-alpha.1

5 years ago

0.3.7-alpha.0

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.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.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