Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface NumberFieldHookOptions

remarks

@since 2.5.0

Hierarchy

Index

Properties

counter?: boolean

Boolean if the FormMessage should also display a counter for the remaining letters allowed based on the maxLength.

This will still be considered false if the maxLength value is not provided.

defaultValue?: number | (() => undefined | number)

The default number value to use which can be a number or undefined. When this value is set to a number (or a function that returns a number), the returned value will never be undefined.

disableMaxLength?: boolean

Boolean if the maxLength prop should not be passed to the TextField component since it will prevent any additional characters from being entered in the text field which might feel like weird behavior to some users. This should really only be used when the counter option is also enabled and rendering along with a FormMessage component.

disableMessage?: boolean

Boolean if the TextField or TextArea will not be rendered along with a FormMessage component. This will prevent the aria-describedby prop from being returned when set to true.

errorIcon?: ReactNode

An optional error icon used in the getErrorIcon option.

fixOnBlur?: FixNumberOnBlur
getErrorIcon?: GetErrorIcon

A function used to get the error icon to display at the right of the TextField or TextArea. The default behavior will only show an icon when the error state is true and an errorIcon option has been provided.

getErrorMessage?: GetErrorMessage

A function to get and display an error message based on the TextField or TextArea validity. See defaultGetErrorMessage for the default implementation details.

helpText?: ReactNode

An optional help text to display in the FormMessage component when there is not an error.

id: string

The id for the text field. This is required for accessibility.

isErrored?: IsErrored

A function used to determine if the TextField or TextArea is an in errored state. See defaultIsErrored for the default implementation details.

max?: number

An optional max value for the number field.

maxLength?: number
min?: number

An optional min value for the number field.

minLength?: number
onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>
onChange?: FormEventHandler<HTMLInputElement | HTMLTextAreaElement>
onErrorChange?: ErrorChangeHandler

An optional function that will be called whenever the error state is changed. This can be used for more complex forms to disable the Submit button or anything else if any field has an error.

pattern?: string
required?: boolean
step?: number

An optional step amount to use.

Note: The min and max values must be divisible by this value when any are defined.

theme?: FormTheme

The current theme type.

updateOnChange?: boolean

Boolean if the number value should be updated as the user types instead of only once the text field has been blurred.

validateOnChange?: ChangeValidationBehavior

Describes the validation behavior that should be done when the value within the TextField changes. This can either be:

  • a boolean
  • the string "recommended"
  • a single key of the ValidityState that should trigger the validation
  • a list of keys of the ValidityState that should trigger the validation

Generated using TypeDoc