Autosize Textarea Ref
spectrumui/autosize-textarea-refFreeComponent
component for the Autosize Textarea Ref
Install it
npx shadcn@latest add https://ui.spectrumhq.in/r/autosize-textarea-ref.jsonSource
1"use client";2import React, { useState } from "react";3import {4 AutosizeTextarea,5 AutosizeTextAreaRef,6} from "@/components/ui/autosize-textarea";78const AutosizeTextareaWithRef = () => {9 const ref = React.useRef<AutosizeTextAreaRef>(null);10 const [currMaxHeight, setCurrMaxHeight] = useState(0);11 React.useEffect(() => {12 if (ref.current) {13 setCurrMaxHeight(ref.current.maxHeight);14 }15 }, []);16 return (17 <div className="flex w-full flex-col gap-2 px-10">18 <p>current max height from ref: {currMaxHeight}</p>19 <AutosizeTextarea20 ref={ref}21 maxHeight={200}22 placeholder="with ref example."23 />24 </div>25 );26};2728export default AutosizeTextareaWithRef;
What it pulls in
Other registry items
Files it writes
More from spectrumui
All 182 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | spectrumui | Components | Free | no deps | |
| Alert demoalert-1 | spectrumui | Components | Free | 1 dep | |
| Alert 2alert-2 | spectrumui | Components | Free | no deps | |
| Alert 3alert-3 | spectrumui | Components | Free | 1 dep | |
| Alert 4alert-4 | spectrumui | Components | Free | 1 dep | |
| Animated Cardanimated-card | spectrumui | Components | Free | 1 dep · 2 files | |
| Animated Draweranimated-drawer | spectrumui | Components | Free | 4 deps | |
| Animated SVG Chartanimated-SVG-chart | spectrumui | Components | Free | 1 dep |
