Time picker example

An Arabic form with stable submitted values.

Localize labels, built-in feedback and reading direction while keeping ASCII time values and stable channel IDs. Translation does not rewrite the form model.

Complete React client module · MIT · Next.js and Vite

Interactive example

An Arabic form with stable submitted values

Localize labels, built-in feedback and reading direction while keeping ASCII time values and stable channel IDs. Translation does not rewrite the form model.

Keyboard

  • Submit without a title, then follow its linked error back to the field.
  • Type HH:mm in the time field. Enter applies; Arabic Cancel restores the prior value.
  • Tab and Space operate the same native channel choices under RTL.

States covered

  • Arabic messages
  • Explicit RTL
  • Linked form errors
  • Native stable values
  • Scoped reduced motion

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-localized-arabic-form.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Button,CheckboxGroup,Field,FormErrorSummary,Input,TimePicker,UIProvider} from '@bld8/ui';
export default function LocalizedFormExample(){const [errors,setErrors]=useState<Record<string,string>>({}),[status,setStatus]=useState('لم يتم إعداد الطلب.');return <UIProvider theme="light" locale="ar" direction="rtl" motion="reduced"><form noValidate aria-label="طلب مراجعة" style={{display:'grid',gap:20,maxWidth:600,padding:24,background:'var(--bui-surface)'}} onSubmit={event=>{event.preventDefault();const data=new FormData(event.currentTarget);if(!String(data.get('title')??'').trim()){setErrors({title:'أدخل عنوان الطلب.'});return;}const time=event.currentTarget.querySelector<HTMLInputElement>('[data-time-field] input:not([type=hidden])');if(time&&!time.checkValidity()){time.reportValidity();return;}setErrors({});setStatus('channel='+data.getAll('channels').join(',')+' | time='+data.get('start'));}}>
  <FormErrorSummary errors={errors} fieldLabels={{title:'عنوان الطلب'}}/>
  <Field label="عنوان الطلب" error={errors.title}><Input name="title" onChange={()=>setErrors({})}/></Field>
  <CheckboxGroup label="قنوات الإشعار" name="channels" defaultValue={['email']} options={[{value:'email',label:'البريد الإلكتروني'},{value:'in-app',label:'داخل التطبيق'}]}/>
  <div data-time-field><TimePicker label="وقت البدء" name="start" editable commitMode="explicit" defaultValue="09:30" minTime="09:00" maxTime="11:00" hourCycle="h23"/></div>
  <Button type="submit">إعداد الطلب</Button><p role="status">{status}</p>
</form></UIProvider>;}