Skip to content

Commit

Permalink
Add className prop support to <Textarea> (#5130)
Browse files Browse the repository at this point in the history
* Add className prop support

* Fix Textarea component className prop formatting

* patch -> minor

Co-authored-by: Josh Black <joshblack@github.com>

* Update prop description

Co-authored-by: Josh Black <joshblack@github.com>

* Remove defaultValue from className in Textarea docs

---------

Co-authored-by: Josh Black <joshblack@github.com>
  • Loading branch information
randall-krauskopf and joshblack authored Oct 16, 2024
1 parent 7b025d9 commit 661e94c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/wicked-ties-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

Add `className` prop support to `Textarea` component
7 changes: 6 additions & 1 deletion packages/react/src/Textarea/Textarea.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@
{
"name": "sx",
"type": "SystemStyleObject"
},
{
"name": "className",
"type": "string | undefined",
"description": "The className to apply to the wrapper element"
}
],
"subcomponents": []
}
}
6 changes: 6 additions & 0 deletions packages/react/src/Textarea/Textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export type TextareaProps = {
* apply a high contrast color to background
*/
contrast?: boolean
/**
* The className to apply to the wrapper element
*/
className?: string
} & TextareaHTMLAttributes<HTMLTextAreaElement> &
SxProp

Expand Down Expand Up @@ -79,6 +83,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
resize = DEFAULT_TEXTAREA_RESIZE,
block,
contrast,
className,
...rest
}: TextareaProps,
ref,
Expand All @@ -90,6 +95,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
disabled={disabled}
block={block}
contrast={contrast}
className={className}
>
<StyledTextarea
value={value}
Expand Down

0 comments on commit 661e94c

Please sign in to comment.