TextArea
Inmatningsfält som används när användaren behöver fylla i längre information t.ex. en beskrivning, kommentar eller fritext. För kortare, striktare inmatning används TextField.
import { TextArea } from '@midas-ds/components'
<TextArea
label='Kommentar'
description='Skriv en kommentar'
/>
Beskrivning
TextArea är en komposition av <TextField>
, <TextArea>
, <Label>
, <FieldError>
och <Text>
som alla är React Aria-komponenter.
Med undantag för type
-attributet erbjuder TextArea
samma API som TextField
, vänligen använd dokumentationen för TextField för mer information.
API
Name | Type | Default | Description |
---|---|---|---|
className | string | ((values: InputRenderProps & { defaultClassName: string; }) => string) | - | |
form | string | - | |
rows | number | - | |
wrap | string | - | |
label | string | - | Specify label displayed above the TextField |
slot | string | - | A slot name for the component. Slots allow the component to receive props from a parent component.
An explicit |
style | CSSProperties | ((values: DisclosureGroupRenderProps & { defaultStyle: CSSProperties; }) => CSSProperties) | - | The inline style for the element. A function may be provided to compute the style based on component state. |
isDisabled | boolean | - | Whether the input is disabled. |
autoFocus | boolean | - | Whether the element should receive focus on render. |
autoComplete | string | - | Describes the type of autocomplete functionality the input should provide if any. See MDN. |
enterKeyHint | "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | - | An enumerated attribute that defines what action label or icon to preset for the enter key on virtual keyboards. See MDN. |
maxLength | number | - | The maximum number of characters supported by the input. See MDN. |
minLength | number | - | The minimum number of characters required by the input. See MDN. |
name | string | - | The name of the input element, used when submitting an HTML form. See MDN. |
size | Size | 'large' | Component size (large: height 48px, medium: height 40px) |
value | DateValue | - | The current value (controlled). |
defaultValue | DateValue | - | The default value (uncontrolled). |
id | string | - | The element's unique identifier. See MDN. |
spellCheck | string | - | An enumerated attribute that defines whether the element may be checked for spelling errors. See MDN. |
autoCorrect | string | - | An attribute that takes as its value a space-separated string that describes what, if any, type of autocomplete functionality the input should provide. See MDN. |
inputMode | "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | - | Hints at the type of data that might be entered by the user while editing the element or its contents. See MDN. |
isReadOnly | boolean | - | Whether the input can be selected but not changed by the user. |
isRequired | boolean | - | Whether user input is required on the input before form submission. |
isInvalid | boolean | - | Whether the value is invalid. |
validationBehavior | "aria" | "native" | 'native' | Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA. |
validate | (value: boolean) => true | ValidationError | - | A function that returns an error message if a given value is invalid.
Validation errors are displayed to the user when the form is submitted
if |
excludeFromTabOrder | boolean | - | Whether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available. |
description | string | - | Specify description displayed below the label |
errorMessage | string | ((validation: ValidationResult) => string) | - | Custom error messages |
errorPosition | "top" | "bottom" | - | |
showCounter | boolean | false | Whether to show the character counter or not |
popover | InfoPopoverProps | - |