15
15
* limitations under the License.
16
16
*/
17
17
18
+ import "bootstrap/dist/css/bootstrap.css" ;
19
+
18
20
import AutoNumeric from "autonumeric" ;
19
21
import { AutoNumericInput } from "../lib/AutoNumericInput" ;
20
22
import { useState } from "react" ;
@@ -23,53 +25,58 @@ export default function App(): JSX.Element {
23
25
const [ controlledInputState , setControlledInputState ] = useState ( "100" ) ;
24
26
return (
25
27
< >
26
- < label >
27
- Most basic usage
28
- < AutoNumericInput />
29
- </ label >
30
-
31
- < hr />
32
-
33
- < label >
34
- Customize the input
35
- < AutoNumericInput
36
- inputProps = { { defaultValue : "99.99" } }
37
- autoNumericOptions = { { suffixText : "%" } }
38
- />
39
- </ label >
40
-
41
- < hr />
28
+ < h1 > React-AutoNumeric Demo</ h1 >
29
+ < div className = "form-group mb-3" >
30
+ < label >
31
+ Most basic usage
32
+ < AutoNumericInput inputProps = { { className : "form-control" } } />
33
+ </ label >
34
+ </ div >
42
35
43
- < label >
44
- Use predefined AutoNumeric options
45
- < AutoNumericInput
46
- inputProps = { { defaultValue : "10000" } }
47
- autoNumericOptions = {
48
- AutoNumeric . getPredefinedOptions ( ) . commaDecimalCharDotSeparator
49
- }
50
- / >
51
- </ label >
36
+ < div className = "form-group mb-3" >
37
+ < label >
38
+ Customize the input
39
+ < AutoNumericInput
40
+ inputProps = { { defaultValue : "99.99" , className : "form-control" } }
41
+ autoNumericOptions = { { suffixText : "%" } }
42
+ />
43
+ </ label >
44
+ </ div >
52
45
53
- < hr />
46
+ < div className = "form-group mb-3" >
47
+ < label >
48
+ Use predefined AutoNumeric options
49
+ < AutoNumericInput
50
+ inputProps = { { defaultValue : "10000" , className : "form-control" } }
51
+ autoNumericOptions = {
52
+ AutoNumeric . getPredefinedOptions ( ) . commaDecimalCharDotSeparator
53
+ }
54
+ />
55
+ </ label >
56
+ </ div >
54
57
55
- < label >
56
- Interact with AutoNumericInput via a React state
57
- < AutoNumericInput
58
- valueState = { {
59
- state : controlledInputState ,
60
- stateSetter : setControlledInputState ,
61
- } }
62
- />
63
- < button
64
- onClick = { ( ) => {
65
- setControlledInputState (
66
- ( Number ( controlledInputState ) + 1 ) . toString ( ) ,
67
- ) ;
68
- } }
69
- >
70
- Add one
71
- </ button >
72
- </ label >
58
+ < div className = "form-group mb-3" >
59
+ < label >
60
+ Interact with AutoNumericInput via a React state
61
+ < AutoNumericInput
62
+ inputProps = { { className : "form-control" } }
63
+ valueState = { {
64
+ state : controlledInputState ,
65
+ stateSetter : setControlledInputState ,
66
+ } }
67
+ />
68
+ < button
69
+ className = "btn btn-primary"
70
+ onClick = { ( ) => {
71
+ setControlledInputState (
72
+ ( Number ( controlledInputState ) + 1 ) . toString ( ) ,
73
+ ) ;
74
+ } }
75
+ >
76
+ Add one
77
+ </ button >
78
+ </ label >
79
+ </ div >
73
80
</ >
74
81
) ;
75
82
}
0 commit comments