-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed expandable textarea and moved textarea to app-components
- Loading branch information
1 parent
70ca6fb
commit d2d27ff
Showing
2 changed files
with
60 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
|
||
import { Textarea } from '@digdir/designsystemet-react'; | ||
import type { CharacterLimitProps } from '@digdir/designsystemet-react/dist/types/components/form/CharacterCounter'; | ||
|
||
//import { Label } from 'your-component-library/Label'; // Adjust the import path accordingly | ||
|
||
export interface TextAreaWithLabelProps { | ||
id: string; | ||
value: string; | ||
onChange: (value: string) => void; | ||
onBlur?: () => void; | ||
readOnly?: boolean; | ||
characterLimit?: CharacterLimitProps | undefined; | ||
error?: boolean; | ||
dataTestId?: string; | ||
ariaDescribedBy?: string; | ||
ariaLabel?: string; | ||
autoComplete?: string; | ||
style?: React.CSSProperties; | ||
} | ||
|
||
export const TextArea: React.FC<TextAreaWithLabelProps> = ({ | ||
id, | ||
value, | ||
onChange, | ||
onBlur, | ||
readOnly = false, | ||
characterLimit, | ||
error = false, | ||
dataTestId, | ||
ariaDescribedBy, | ||
ariaLabel, | ||
autoComplete, | ||
style, | ||
}) => ( | ||
<Textarea | ||
id={id} | ||
onChange={(e) => onChange(e.target.value)} | ||
onBlur={onBlur} | ||
readOnly={readOnly} | ||
characterLimit={characterLimit} | ||
error={error} | ||
value={value} | ||
data-testid={dataTestId} | ||
aria-describedby={ariaDescribedBy} | ||
aria-label={ariaLabel} | ||
autoComplete={autoComplete} | ||
style={style} | ||
/> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters