Socket
Socket
Sign inDemoInstall

@paprika/textarea

Package Overview
Dependencies
92
Maintainers
3
Versions
97
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @paprika/textarea

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


Version published
Weekly downloads
871
decreased by-8.8%
Maintainers
3
Install size
2.91 MB
Created
Weekly downloads
 

Readme

Source

@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.
maxHeight[number,string]false300The maximum height of the textarea.
minHeight[number,string]false80The 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.LARGE]falseTextarea.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
  • Storybook Showcase
  • GitHub source code
  • Create GitHub issue
  • CHANGELOG

FAQs

Last updated on 22 Apr 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc