NumericInput
Install
yarn add @ntds/text-inputImport
import { NumericInput } from '@ntds/text-input';Props
| Prop | Type | Default | Description |
|---|---|---|---|
value? | number | — | The value of the NumericInput |
setValue? | (value?: number) => void | — | Pass your setter from useState() directly here |
label? | string | — | Whether or not the labels should be included. |
placeholder? | string | — | Placeholder for input |
suffix? | string | — | Custom suffix for the input |
error? | string | boolean | ((id: string) => ReactNode) | — | Mark the input as invalid both visually and semantically Given as a `string`: Will render the message inside a Message component under the input Will not use aria-live Given as a `ReactNode`: Will render the content with margin dictated by the TextInput Use the `Message` component from @ntds /message |
tw? | TwGroupKeys | — | Tailwind overrides |
maxLength? | number | — | The max length to allow in the input |
hint? | string | — | Displays a hint under the input Note: Will not be shown if `error` is given as a string or a ReactNode. |
onFocusEvent? | (e: FocusEvent<HTMLInputElement, Element>) => void | — | Custom onFocus event |
onBlurEvent? | (e: FocusEvent<HTMLInputElement, Element>) => void | — | Custom onBlur event |
elementRef? | Ref<HTMLInputElement> | — | Get the DOM-reference from the TextInput-element |