feat(renderer): add shadcn textarea primitive

This commit is contained in:
2026-06-05 17:09:59 +05:30
parent 66e2b56221
commit d8ee743fb1
2 changed files with 36 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import * as React from "react"
import { cn } from "@/lib/utils"
export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, ...props }, ref) => {
return (
<textarea
className={cn(
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className
)}
ref={ref}
{...props}
/>
)
}
)
Textarea.displayName = "Textarea"
export { Textarea }
+12
View File
@@ -0,0 +1,12 @@
import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/react';
import { Textarea } from '@/components/ui/textarea';
describe('Textarea', () => {
it('renders a multi-line input', () => {
render(<Textarea aria-label="notes" defaultValue="hello" />);
const ta = screen.getByLabelText(/notes/i);
expect(ta.tagName).toBe('TEXTAREA');
expect(ta).toHaveValue('hello');
});
});