Skip to content

Commit 661e94c

Browse files
Add className prop support to <Textarea> (#5130)
* Add className prop support * Fix Textarea component className prop formatting * patch -> minor Co-authored-by: Josh Black <[email protected]> * Update prop description Co-authored-by: Josh Black <[email protected]> * Remove defaultValue from className in Textarea docs --------- Co-authored-by: Josh Black <[email protected]>
1 parent 7b025d9 commit 661e94c

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.changeset/wicked-ties-walk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': minor
3+
---
4+
5+
Add `className` prop support to `Textarea` component

packages/react/src/Textarea/Textarea.docs.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@
6060
{
6161
"name": "sx",
6262
"type": "SystemStyleObject"
63+
},
64+
{
65+
"name": "className",
66+
"type": "string | undefined",
67+
"description": "The className to apply to the wrapper element"
6368
}
6469
],
6570
"subcomponents": []
66-
}
71+
}

packages/react/src/Textarea/Textarea.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export type TextareaProps = {
3131
* apply a high contrast color to background
3232
*/
3333
contrast?: boolean
34+
/**
35+
* The className to apply to the wrapper element
36+
*/
37+
className?: string
3438
} & TextareaHTMLAttributes<HTMLTextAreaElement> &
3539
SxProp
3640

@@ -79,6 +83,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
7983
resize = DEFAULT_TEXTAREA_RESIZE,
8084
block,
8185
contrast,
86+
className,
8287
...rest
8388
}: TextareaProps,
8489
ref,
@@ -90,6 +95,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
9095
disabled={disabled}
9196
block={block}
9297
contrast={contrast}
98+
className={className}
9399
>
94100
<StyledTextarea
95101
value={value}

0 commit comments

Comments
 (0)