@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
68 lines (67 loc) • 2 kB
TypeScript
import React from "react";
import { FormFieldProps } from "./../useFormField.js";
export interface TextareaProps extends FormFieldProps, React.TextareaHTMLAttributes<HTMLTextAreaElement> {
/**
* Allowed character-count for content
*
* This is just a visual indicator! You will still need to handle actual character-limits/validation if needed.
*/
maxLength?: number;
/**
* Controlled value
*/
value?: string;
/**
* Defaults input-value without needing controlled-state
*/
defaultValue?: string;
/**
* Maximum number of character rows to display.
*/
maxRows?: number;
/**
* Minimum number of character-rows to display when empty.
*/
minRows?: number;
/**
* Textarea label.
*/
label: React.ReactNode;
/**
* If enabled shows the label and description for screenreaders only.
*/
hideLabel?: boolean;
/**
* Enables resizing of field.
*/
resize?: boolean | "vertical" | "horizontal";
/**
* Textarea will stop growing and get a scrollbar when there's no more room to grow.
* Requires `display:flex` on the parent.
* Experimental feature that may be removed or get breaking changes in a minor version.
*/
UNSAFE_autoScrollbar?: boolean;
/**
* i18n-translations for counter-text
* @deprecated Use `<Provider />`-component
*/
i18n?: {
/** @default tegn igjen */
counterLeft?: string;
/** @default tegn for mye */
counterTooMuch?: string;
};
}
/**
* A component that displays a textarea input field with a label.
*
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/textarea)
* @see 🏷️ {@link TextareaProps}
*
* @example
* ```jsx
* <Textarea label="Har du noen tilbakemeldinger?" />
* ```
*/
export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
export default Textarea;