Components Forms

NumberInput, DateTimeInput, Popconfirm

A number field that is empty as null, a date or date-and-time field, and a confirmation beside the button it guards.

import { NumberInput, DateTimeInput, Popconfirm } from '@kition/tessera-ui'

Examples

Price, start time, delete
form-inputs.tsx
import { useState } from 'react'
import { Button, DateTimeInput, NumberInput, Popconfirm, toast } from '@kition/tessera-ui'

export default function Demo() {
  const [price, setPrice] = useState<number | null>(0.25)
  const [start, setStart] = useState<string | null>('2026-10-25T09:00')
  return (
    <div className="demo-row" style={{ alignItems: 'flex-end' }}>
      <label style={{ display: 'grid', gap: 6 }}>
        Price per call
        <NumberInput value={price} onChange={setPrice} min={0} step={0.05} precision={2} style={{ width: 140 }} />
      </label>
      <label style={{ display: 'grid', gap: 6 }}>
        From
        <DateTimeInput withTime value={start} onChange={setStart} />
      </label>
      <Popconfirm title="Delete this pricing rule?" description="Calls are charged by the default rule afterwards." danger okText="Delete" onConfirm={() => toast('success', 'Rule deleted')}>
        <Button variant="danger">Delete rule</Button>
      </Popconfirm>
    </div>
  )
}

Props

NumberInput

A field for a number, empty as null; arrows step it, and it rounds to precision when left.

PropTypeDefaultDescription
valuenumber | null | ''—Optional inside a FormItem, which supplies it.
onChange(value: number | null) => void—
minnumber—
maxnumber—
stepnumber1
precisionnumber—Decimals kept when the field is left.
sizeControlSize'sm'
invalidboolean—

Also takes the attributes of its HTML element (`className`, `aria-*`, events…).

DateTimeInput

A date, or a date and time, from the platform's picker; cleared to null.

PropTypeDefaultDescription
valuestring | null—Optional inside a FormItem, which supplies it.
onChange(value: string | null) => void—
withTimeboolean—Asks for a time too.
sizeControlSize'sm'
invalidboolean—

Also takes the attributes of its HTML element (`className`, `aria-*`, events…).

Popconfirm

Asks "are you sure?" next to the button that does something, before it does.

PropTypeDefaultDescription
titlerequiredReactNode—
descriptionReactNode—
onConfirmrequired() => void—
okTextstring—
cancelTextstring—
dangerboolean—Draws OK as a destructive button.
disabledboolean—Lets the trigger act without asking.
childrenrequiredReactElement—The button that asks.