Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
rc-textarea
Advanced tools
The rc-textarea package is a React component for creating and managing text areas with advanced features such as auto-resizing, character counting, and more. It is designed to be highly customizable and easy to integrate into any React application.
Auto-resizing Textarea
This feature allows the textarea to automatically resize based on the content, with a specified minimum and maximum number of rows.
import React from 'react';
import TextArea from 'rc-textarea';
const AutoResizeExample = () => (
<TextArea autoSize={{ minRows: 2, maxRows: 6 }} />
);
export default AutoResizeExample;
Character Counting
This feature provides a character count for the textarea, showing the user how many characters they have typed and the maximum allowed.
import React, { useState } from 'react';
import TextArea from 'rc-textarea';
const CharCountExample = () => {
const [value, setValue] = useState('');
const maxLength = 100;
return (
<div>
<TextArea
value={value}
onChange={(e) => setValue(e.target.value)}
maxLength={maxLength}
/>
<div>{value.length}/{maxLength} characters</div>
</div>
);
};
export default CharCountExample;
Customizable Styles
This feature allows developers to apply custom styles to the textarea component, making it easy to match the design of their application.
import React from 'react';
import TextArea from 'rc-textarea';
const CustomStyleExample = () => (
<TextArea style={{ border: '2px solid red', padding: '10px' }} />
);
export default CustomStyleExample;
The react-textarea-autosize package provides a similar auto-resizing functionality for textareas in React. It is lightweight and easy to use, but it may not offer as many built-in features as rc-textarea, such as character counting.
The react-textarea package is another alternative that offers basic textarea functionalities with some customization options. It is simpler compared to rc-textarea and may be suitable for projects that do not require advanced features.
The react-autosize-textarea package focuses on providing auto-resizing capabilities for textareas in React. It is similar to react-textarea-autosize but may have different performance characteristics and API design.
Pretty Textarea react component used in ant.design.
https://react-component.github.io/textarea/
import Textarea from 'rc-textarea';
import { render } from 'react-dom';
render(<Textarea />, mountNode);
Property | Type | Default | Description |
---|---|---|---|
prefixCls | string | rc-textarea | |
className | string | '' | additional class name of textarea |
style | React.CSSProperties | - | style properties of textarea |
autoSize | boolean | object | - | Height autosize feature, can be set to true|false or an object { minRows: 2, maxRows: 6 } |
onPressEnter | function(e) | - | The callback function that is triggered when Enter key is pressed |
onResize | function({ width, height }) | - | The callback function that is triggered when resize |
npm install
npm start
rc-textarea is released under the MIT license.
FAQs
Pretty Textarea react component used in used in ant.design
The npm package rc-textarea receives a total of 1,129,748 weekly downloads. As such, rc-textarea popularity was classified as popular.
We found that rc-textarea demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.