Skip to main content

error

Description

Optional. Defines whether error styling is applied to a date picker

Usage

error?: boolean;

Default value

  • true - error styling is applied to a date picker
  • false - (default) error styling is not applied to a date picker

Example

<DatePicker error={true}/>

Details

The property is useful during a form validation. If the property is set to true the date picker gets error styling: the input's border and the date value become red.

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

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

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

Related article: Styling a date validation error

Related sample: DatePicker