error
Description
defines whether error styling is applied to a rich selectType
boolean
Default value
false
Example
<script>
const dataset = [
{id:1, name:"First option"},
{id:2, name:"Second option"},
{id:3, name:"Third option"}
]
</script>
<RichSelect options={dataset} value={1} error={true}/>
Details
The property is useful during a form validation. If the property is set to true
(or just specified without a value) and the input value fails validation, a rich select gets error styling: the input's borders and the selected option's value become red.
To add a red error label for the control, use the error property of the Field control:
<script>
import { RichSelect, Field } from "wx-svelte-core";
</script>
<Field label="Error" error let:id>
<RichSelect {id} error={true}/> <!-- equals to <RichSelect {id} error/> -->
</Field>
Related article: Styling an option validation error
Related sample: RichSelect