React · Controlled
onUpdate Event
React to every time change in real-time
Live Updates
The onUpdate event fires on every time change:
Real-time Updates
See changes as you select hours and minutes
Live value: Not selected
index.tsxtsx
1import { Timepicker } from "timepicker-ui-react";2import { useState } from "react";34function App() {5 const [liveTime, setLiveTime] = useState("");67 return (8 <div>9 <Timepicker10 onUpdate={(data) => {11 setLiveTime(`${data.hour}:${data.minutes} ${data.type || ""}`);12 }}13 />14 <p>Live value: {liveTime}</p>15 </div>16 );17}
onUpdate vs onConfirm
Choose the right event for your use case:
| Event | When it fires | Use case |
|---|---|---|
onUpdate | Every time change | Live preview, real-time sync |
onConfirm | OK button click | Form submission, final value |