Skip to main content

error

Description

Optional. Defines whether error styling is applied to an area

Usage

error?: boolean;

Parameters

  • true - the error style is applied to an area
  • false - (default) the error style is not applied to an area

Example

<TextArea error={true} />

Details

The property is useful during a form validation. If the property is set to true the TextArea control gets error styling: the control's borders and the entered text become red.

To add a red error label for the control, use the error property of the Field control:

<script>
import { TextArea, Field } from "@svar-ui/svelte-core";
</script>

<Field label="Error message" error={true}>
{#snippet children(id)}
<TextArea {id} error={true}/>
{/snippet}
</Field>

Related article: Styling a validation error

Related sample: TextArea