@@ -8,9 +8,8 @@ type ContentEditableProps = ComponentProps<typeof ContentEditable>;
88export interface TextareaProps extends ContentEditableProps {
99 label ?: string ;
1010 labelDisplay ?: "hidden" | "visible" ;
11+ /** An error message to display to the user */
1112 error ?: string ;
12- helperText ?: string ;
13- variant ?: "default" | "bordered" | "filled" ;
1413 size ?: "small" | "medium" | "large" ;
1514 id ?: string ;
1615 children ?: React . ReactNode ;
@@ -20,18 +19,15 @@ export const Textarea: FC<TextareaProps> = ({
2019 label,
2120 labelDisplay = "visible" ,
2221 error,
23- helperText,
24- variant = "default" ,
2522 size = "medium" ,
2623 children,
2724 ...rest
2825} ) => {
2926 const textareaId = `textarea-contenteditable-container` ;
3027 const labelId = `textarea-label` ;
31- const helperId = `textarea-helper` ;
3228
3329 return (
34- < div className = { styles . container } >
30+ < div className = { styles . container } data-error = { ! ! error } >
3531 { label && (
3632 < label
3733 className = { labelDisplay === "hidden" ? styles . visuallyHidden : styles . label }
@@ -43,12 +39,9 @@ export const Textarea: FC<TextareaProps> = ({
4339 </ label >
4440 ) }
4541 < div
46- aria-describedby = { helperId }
4742 aria-labelledby = { label ? labelId : undefined }
4843 className = { styles . textarea }
49- data-error = { ! ! error }
5044 data-size = { size }
51- data-variant = { variant }
5245 id = { textareaId }
5346 >
5447 < ContentEditable
@@ -60,9 +53,9 @@ export const Textarea: FC<TextareaProps> = ({
6053 />
6154 { children && < div className = { styles . childrenContainer } > { children } </ div > }
6255 </ div >
63- { ( error || helperText ) && (
64- < div className = { styles . helperText } data-error = { ! ! error } id = { helperId } >
65- { error || helperText }
56+ { error && (
57+ < div className = { styles . errorMessage } aria-live = "polite" >
58+ { error }
6659 </ div >
6760 ) }
6861 </ div >
0 commit comments