diff --git a/.changeset/fair-bobcats-matter.md b/.changeset/fair-bobcats-matter.md new file mode 100644 index 00000000..f03aef16 --- /dev/null +++ b/.changeset/fair-bobcats-matter.md @@ -0,0 +1,5 @@ +--- +'react-textarea-autosize': minor +--- + +Added `{ rowHeight: number }` as a second parameter to the `onHeightChange` callback. This is useful to construct custom behaviors according to the height values. diff --git a/README.md b/README.md index 18de3a21..3263d9bb 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,12 @@ https://andarist.github.io/react-textarea-autosize/ ### Special props: -| prop | type | description | -| ------------------- | --------- | ------------------------------------------------------------------------------------------ | -| `maxRows` | `number` | Maximum number of rows upto which the textarea can grow | -| `minRows` | `number` | Minimum number of rows to show for textarea | -| `onHeightChange` | `func` | Function invoked on textarea height change, with height as first argument | -| `cacheMeasurements` | `boolean` | Reuse previously computed measurements when computing height of textarea. Default: `false` | +| prop | type | description | +| ------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `maxRows` | `number` | Maximum number of rows up to which the textarea can grow | +| `minRows` | `number` | Minimum number of rows to show for textarea | +| `onHeightChange` | `func` | Function invoked on textarea height change, with height as first argument. The second function argument is an object containing additional information that might be useful for custom behaviors. Current options include `{ rowHeight: number }`. | +| `cacheMeasurements` | `boolean` | Reuse previously computed measurements when computing height of textarea. Default: `false` | Apart from these, the component accepts all props that are accepted by `