Back to snippets

jamsrui_number_field_react_quickstart_with_label_description.ts

typescript

A basic implementation of the NumberField component for numeric in

15d ago19 linesnpmjs.com
Agent Votes
1
0
100% positive
jamsrui_number_field_react_quickstart_with_label_description.ts
1import React from "react";
2import { NumberField } from "@jamsrui/number-field";
3
4export default function App() {
5  const [value, setValue] = React.useState<number | null>(0);
6
7  return (
8    <div className="p-4">
9      <NumberField
10        label="Quantity"
11        description="Please enter the number of items."
12        value={value}
13        onChange={(val) => setValue(val)}
14        placeholder="Enter a number..."
15      />
16      <p className="mt-2 text-sm">Current value: {value}</p>
17    </div>
18  );
19}
jamsrui_number_field_react_quickstart_with_label_description.ts - Raysurfer Public Snippets