Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
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
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.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.