error
Description
Optional. Defines whether error styling is applied to a comboUsage
error?: boolean;
Parameters
true
- error styling is appliedfalse
- (default) error styling is not applied
Example
const dataset = [
{ id: 1, label: "First option" },
{ id: 2, label: "Second option" },
{ id: 3, label: "Third option" }
];
<Combo options={dataset} value={1} error={true} />;
Details
The property is useful during a form validation. If the property is set to true
a combo 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:
import { Combo, Field } from "@svar-ui/react-core";
<Field label="Error message" error={true}>
{(id) => <Combo id={id} error={true} />}
</Field>
Related article: Styling an option validation error
Related sample: Combo