Examples
Price, start time, delete
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.
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | null | '' | — | Optional inside a FormItem, which supplies it. |
onChange | (value: number | null) => void | — | |
min | number | — | |
max | number | — | |
step | number | 1 | |
precision | number | — | Decimals kept when the field is left. |
size | ControlSize | 'sm' | |
invalid | boolean | — |
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.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | null | — | Optional inside a FormItem, which supplies it. |
onChange | (value: string | null) => void | — | |
withTime | boolean | — | Asks for a time too. |
size | ControlSize | 'sm' | |
invalid | boolean | — |
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.
| Prop | Type | Default | Description |
|---|---|---|---|
titlerequired | ReactNode | — | |
description | ReactNode | — | |
onConfirmrequired | () => void | — | |
okText | string | — | |
cancelText | string | — | |
danger | boolean | — | Draws OK as a destructive button. |
disabled | boolean | — | Lets the trigger act without asking. |
childrenrequired | ReactElement | — | The button that asks. |