0.2.1 • Published 4 years ago

@bdt-component-library/number-field v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

NumberField Component

About

This is a component published as its own package from our component library monorepo: https://github.com/BenefitsDataTrust/ui-components. Setup instructions, as well as higher-level goals and concerns can be found from the main project README.

Description

Handles numerical input with custom buttons for incrementing/decrementing. At this time, the component only handles controlled inputs, meaning that it cannot have an undefined value or a placeholder.

API

proptyperequireddefaultexplanation
classNamestringno""Adds an optional classname to the field
idstringyesnoInput id attr
valuenumberyesn/aInput value
tabIndexnumbernoundefinedAllows us to supply a tabindex attr to the input
requiredbooleannofalseDetermines if the input is required
namestringno""Input name attr
disabledbooleannofalseDetermines input disabled state
onChangefunction(e: event, val: number)yesn/aEvent handler for onchange events
hasSuccessbooleannofalseDetermines success state
hasErrorbooleannofalseDetermines error state
minnumbernoundefinedSets min attr for input
maxnumbernoundefinedSets max attr for input
noBottomMarginbooleannofalseRemoves bottom margin of input for more control over formatting
stepnumberno1Sets step attr for input
testIdstringno""Allows an id to be added for testing purposes via the data-testid attr
onBlurfunction(e: event)no() => {}Event handler for onblur events
readOnlybooleannofalseProperty that prevents the user from entering text in the input
0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.0

4 years ago

0.0.0

4 years ago