Norsk Tipping Design System

NumericInput

Install

yarn add @ntds/text-input

Import

import { NumericInput } from '@ntds/text-input';

Props

PropTypeDefaultDescription
value?numberThe value of the NumericInput
setValue?(value?: number) => voidPass your setter from useState() directly here
label?stringWhether or not the labels should be included.
placeholder?stringPlaceholder for input
suffix?stringCustom 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?TwGroupKeysTailwind overrides
maxLength?numberThe max length to allow in the input
hint?stringDisplays 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>) => voidCustom onFocus event
onBlurEvent?(e: FocusEvent<HTMLInputElement, Element>) => voidCustom onBlur event
elementRef?Ref<HTMLInputElement>Get the DOM-reference from the TextInput-element

On this page