Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 105x 429x 105x | import * as React from "react";
import { TextareaProps } from "shared-types";
import { cn } from "@/utils";
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, ...props }, ref) => {
const strLn = (typeof props?.value === "string" && props.value.length) || 0;
return (
<>
<textarea
className={cn(
"flex min-h-[76px] w-full rounded-sm border border-black bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
className,
)}
ref={ref}
{...props}
/>
{props.charCount && (
<p
className={cn("text-right text-gray-500 pr-2 text-sm", props.charCountClassName)}
>{`${strLn}${
props.maxLength && props.charCount === "limited" ? `/${props.maxLength}` : ""
}`}</p>
)}
</>
);
},
);
Textarea.displayName = "Textarea";
export { Textarea };
|