Skip to main content

error

Description

Optional. Defines whether error styling is applied to the Counter control

Usage

error?: boolean;

Parameters

  • true - error styling is applied to the Counter control
  • false - (default) error styling is not applied to the Counter control

Example

<Counter error={true} />

Details

The property is useful during a form validation. If the property is set to true a counter control gets error styling: the input'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:

import { Counter, Field } from "@svar-ui/react-core";

export default function Example() {
return (
<Field label="Error message" error={true}>
{({ id }) => <Counter id={id} error={true} />}
</Field>
);
}

Related article: Styling a validation error

Related sample: Counter