Components
Numeric Field

Numeric Field

A numeric field component for use inside a form, used for number input

About

The NumericField is built using a composition of the <TextField /> component.

Usage

'use client';
 
import * as React from 'react';
 
import { NumericField } from '@/components/ui/formfield';
 
export function NumericFieldDemo() {
  const [age, setAge] = React.useState(20);
  return (
    <form>
      <NumericField name="price" label="Amount" defaultValue={0} />
      <NumericField name="age" label="Age" value={age} onChange={(e) => setAge(e.target.value)} min={1} max={111} />
    </form>
  );
}
'use client';
 
import * as React from 'react';
 
import { NumericField } from '@/components/ui/formfield';
 
export function NumericFieldDemo() {
  const [age, setAge] = React.useState(20);
  return (
    <form>
      <NumericField name="price" label="Amount" defaultValue={0} />
      <NumericField name="age" label="Age" value={age} onChange={(e) => setAge(e.target.value)} min={1} max={111} />
    </form>
  );
}

API Reference

PropTypeDefault
name*string
idstring
labelstring
placeholderstring
requiredboolean
readOnlyboolean
errorstring
minnumber
maxnumber
roundTonumber
valueany
onChangeevent
onBlurevent