Giter Club home page Giter Club logo

unstyled-textarea-autosize's Introduction

<UnstyledTextareaAutosize />

npm version GitHub checks

<UnstyledTextareaAutosize /> is an unstyled multi-line text component for React that adapts to its content.

Installation

Use your favourite manager to install the package:

yarn add unstyled-textarea-autosize
npm install unstyled-textarea-autosize --save

Example

import React from "react";
import { UnstyledTextareaAutosize } from "unstyled-textarea-autosize";

export function Example({
    value,
    onChange,
}: {
    value: string;
    onChange: (value: string) => void;
}) {
    return (
        <UnstyledTextareaAutosize
            className="example"
            value={value}
            onValueChange={onChange}
        />
    );
}

Properties

The component accepts all properties of the intrinsic div component, including the style and className properties. In addition, it accepts the following properties:

  • readOnly?: boolean: Content cannot be edited if set to true.
  • value?: string: The current content value of the text component (controlled mode).
  • initialValue?: string: The initial content value of the text component (uncontrolled mode).
  • onValueChange?: (value: string) => void: A callback function that is called each time the user edits the content.

Attributes

A reference to the component provides all attributes of the intrinsic div DOM element. In addition, it provides the following attribute:

  • value: string: The current content value of the text component.

Please use the exported type UnstyledTextareaAutosizeElement for the reference.

License

This library is licensed under the MIT license.

Contributing

We welcome contributions to the unstyled-textarea-autosize library. To contribute, simply open a pull request with your changes.

unstyled-textarea-autosize's People

Contributors

coreprocess avatar ndedakaduki avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

lukaskupczyk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.