1.0.0 • Published 4 months ago

svelte-textarea-autosize v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

svelte-textarea-autosize

textarea autosize input component for the web built with svelte.

Installation

Install my-project with npm

 npm i svelte-textarea-autosize

Usage/Examples

 <script type="ts">
    import SvelteAutoResizeTextarea from 'svelte-textarea-autosize';
    let inputValue: string = ''
 </script>
  <SvelteAutoResizeTextarea
    textareaStyle="width: 300px;"
    className="my-custom-class"
    bind:textareaValue={inputValue}
    minRows={2}
    maxRows={5}
    onHeightChange={(height) => console.log(`Height changed to ${height}px`)}
    onPressEnter={() => console.log("Enter key pressed")}
    placeholder="Type something..."
  />

Props

NameTypeRequiredDefault
textareaValueStringtrue-
textareaStyleStringfalse-
classNameStringfalse-
minRowsNumberfalse2
maxRowsNumberfalse3
onHeightChangeFunction ((height: string | number) => void)false-
onPressEnterFunction (() => void)false-
placeholderStringfalse-
fontSizeNumber (default: 16)false16