Skip to content
Drivn
4 min read

Drivn vs shadcn/ui — Textarea Compared

Both Drivn and shadcn/ui ship a dependency-free Textarea. Compare the styling pattern, ref handling, focus ring, and validation behaviour side by side.

Textarea is where Drivn and shadcn/ui start closest together. Neither wraps Radix, neither adds a runtime UI package, and both render one styled <textarea> you can read in a minute. So the comparison is not about what lands in node_modules — it is about how the component is written and what it does before you touch it. Drivn's Textarea lives at packages/drivn/src/registry/components/textarea.ts as a React.forwardRef component with every class held in one const styles object. shadcn/ui's version is a plain function that sets data-slot="textarea", inlines a long cn() string, and relies on React 19's ref-as-prop.

On focus, the two now match. Drivn's styles.base draws a 3px focus-visible ring at ring-ring/50 and switches the border to border-ring, the same treatment as its single-line Input, so keyboard users get a clear indicator out of the box. The defaults still differ in two places: shadcn styles aria-invalid with a destructive ring and auto-grows with field-sizing-content, while Drivn keeps a fixed min-h-[80px] with a resize-y handle. Because Drivn's classes sit in one key of a file you own, either behaviour is a short className away.

Below: the styles object in verbatim source, ref handling, and how to add validation styling and auto-grow without forking the component.

Side-by-side comparison

FeatureDrivnshadcn/ui
Install commandnpx drivn add textareanpx shadcn@latest add textarea
Runtime UI dependenciescn() utility only — zero npm UI packagescn() only — also dependency-free
Styling patternSingle const styles objectInline cn() class string in className
Ref handlingExplicit React.forwardRefReact 19 ref-as-prop (no forwardRef)
Works with react-hook-formYes — ref forwards to the textareaYes — ref forwards to the textarea
Resize behaviourresize-y — vertical onlyfield-sizing-content auto-grow
Min heightmin-h-[80px]min-h-16
Border radiusrounded-[10px]rounded-md
Focus ringYes — 3px focus-visible ringYes — focus-visible ring
aria-invalid stylingYes — destructive ring on invalid
LicenseMITMIT

One styles object vs one inline class string

Drivn puts every Textarea class in a single const styles object with one base key, built through cn(). The six lines read top to bottom as sizing, border, text and placeholder colour, the outline reset, the focus-visible ring, then resize and disabled states, and a caller className merges over the result. shadcn/ui applies a similar set of utilities but inlines them in the cn() call inside the JSX, next to a data-slot="textarea" attribute it uses as a styling hook.

Neither approach adds a dependency, so the choice comes down to how you want to read and edit the component. With Drivn, restyling means editing one named key, and the transition-[color,box-shadow] line tells you exactly which properties animate when the ring appears. Both end up as the same native <textarea>. See the full surface on the Textarea reference.

1// packages/drivn/src/registry/components/textarea.ts — verbatim
2const styles = {
3 base: cn(
4 'w-full min-h-[80px] px-4 py-3',
5 'border border-input rounded-[10px]',
6 'text-foreground placeholder:text-muted-foreground text-sm',
7 'focus:outline-none transition-[color,box-shadow]',
8 'focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:border-ring',
9 'resize-y disabled:opacity-50 disabled:cursor-default'
10 ),
11}

Explicit forwardRef vs React 19 ref-as-prop

Drivn's Textarea is wrapped in React.forwardRef<HTMLTextAreaElement, TextareaProps>, so the ref lands directly on the underlying <textarea>. That is what lets react-hook-form register the field, what gives you imperative focus, and what keeps the component working on React 18 as well as 19. shadcn/ui's current Textarea drops forwardRef entirely and is a plain function that spreads props — it relies on React 19 treating ref as a normal prop.

Functionally the result is the same on React 19: both forward the ref to the textarea, so both work with form libraries and focus management. The difference is compatibility surface — Drivn's explicit forwardRef is the conservative choice that behaves identically across React versions, while shadcn's leaner signature assumes React 19. The props type is just React.TextareaHTMLAttributes<HTMLTextAreaElement>, so every native attribute — rows, maxLength, name, onChange — passes straight through.

1// packages/drivn/src/registry/components/textarea.ts — verbatim
2type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>
3
4export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(({
5 className,
6 ...props
7}, ref) => (
8 <textarea
9 ref={ref}
10 className={cn(styles.base, className)}
11 {...props}
12 />
13))

Validation styling and auto-grow, one className away

With the focus ring already in styles.base, two defaults still separate the components. shadcn/ui's Textarea paints a destructive border and ring when a field carries aria-invalid, and it uses field-sizing-content so the box grows with the text. Drivn's Textarea does neither by default: it starts at min-h-[80px] and gives the user a resize-y handle to drag, which keeps layouts predictable in dense forms and settings panels.

When you want shadcn's behaviour, you do not need a different component. Pass aria-[invalid=true]:border-destructive for a validation state and field-sizing-content resize-none for auto-grow through className, and cn() merges them over the base classes. If every textarea in the app should behave that way, add them to styles.base once instead. The ref still lands on the native element, so form libraries keep working. The Textarea examples page shows labelled fields and character counters, and the same own-the-file trade runs through the other Drivn vs shadcn comparisons.

1"use client"
2
3import * as React from "react"
4import { Textarea } from "@/components/ui/textarea"
5import { cn } from "@/utils/cn"
6
7export default function FeedbackField() {
8 const [value, setValue] = React.useState("")
9 const invalid = value.length > 500
10
11 return (
12 <Textarea
13 value={value}
14 onChange={(e) => setValue(e.target.value)}
15 aria-invalid={invalid}
16 placeholder="Type your message..."
17 className={cn(
18 "field-sizing-content resize-none",
19 "aria-[invalid=true]:border-destructive"
20 )}
21 />
22 )
23}
Get started

Install Drivn in one command

Copy the source into your project and own every line. Zero runtime dependencies, pure React + Tailwind.

npx drivn@latest create

Requires Node 18+. Works with npm, pnpm, and yarn.

Enjoying Drivn?
Star the repo on GitHub to follow new component releases.
Star →

Frequently asked questions

Neither. Textarea is one of the components where both libraries ship a plain styled <textarea> with no headless primitive. Drivn imports only React and the cn() helper; shadcn/ui also has no Radix dependency for Textarea. The comparison is about styling pattern, ref handling, and default behaviour — not about a dependency in your tree, because there is none on either side.

Yes. Drivn wraps the Textarea in React.forwardRef<HTMLTextAreaElement, TextareaProps>, so the ref lands on the underlying textarea element. That makes it work with react-hook-form register, imperative focus, and any code that needs the DOM node. shadcn/ui drops the explicit forwardRef and relies on React 19 treating ref as a prop, which forwards the ref the same way on React 19.

Yes. The styles.base object resets the browser outline with focus:outline-none, then adds focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:border-ring, so keyboard focus draws a soft 3px ring and a ring-coloured border. Mouse clicks do not trigger it, because focus-visible only matches keyboard-style focus. The Drivn Input uses the same classes, so single-line and multi-line fields look identical in a form.

Drivn uses resize-y, giving a vertical drag handle and a fixed min-h-[80px] starting height — the user resizes it. shadcn/ui uses field-sizing-content, so the textarea auto-grows to fit the typed content. Both are valid; pick auto-grow when you want the box to follow the content, and resize-y when you want the user to control the height.

Yes. Both type their props as React.TextareaHTMLAttributes<HTMLTextAreaElement>, so rows, maxLength, name, value, onChange, placeholder, and every other native textarea attribute pass straight through. Drivn spreads {...props} onto the textarea after applying its styles, and a caller className is merged over the base with cn() so you can override or extend the defaults.