💨

動的にTextInputの高さを変更したい!

2022/07/21に公開

https://github.com/chakra-ui/chakra-ui/issues/670#issuecomment-669916624

import { Textarea } from "@chakra-ui/core";
import ResizeTextarea from "react-textarea-autosize";
import React from "react";

export const AutoResizeTextarea = React.forwardRef((props, ref) => {
  return (
    <Textarea
      minH="unset"
      overflow="hidden"
      w="100%"
      resize="none"
      ref={ref}
      minRows={1}
      as={ResizeTextarea}
      {...props}
    />
  );
});

Discussion