Demos#
Default#
Days 1–28 with "Last day of the month".
<Field.InstallmentDay onChange={(value) => console.log('onChange', value)} />
With a value#
<Field.InstallmentDay value={15} />
Constrained days#
Use the days prop to limit available options to specific days.
<Field.InstallmentDay days={[1, 5, 10, 15, 20, 25]} onChange={(value) => console.log('onChange', value)} />
Without last day of the month#
Use showLastDay={false} to hide the "Last day of the month" option.
<Field.InstallmentDay showLastDay={false} onChange={(value) => console.log('onChange', value)} />
Constrained days without last day#
Combine days and showLastDay={false} for a compact selection without the "Last day of the month" option.
<Field.InstallmentDay days={[1, 5, 10, 15, 20, 25]} showLastDay={false} onChange={(value) => console.log('onChange', value)} />
Required#
<Form.Handler onSubmit={(data) => console.log('onSubmit', data)}> <Field.InstallmentDay path="/installmentDay" required /> <Form.SubmitButton top="small" /> </Form.Handler>
Disabled#
<Field.InstallmentDay value={10} disabled />
With help#
<Field.InstallmentDay help={{ title: 'What is an installment day?', content: 'The installment day is the day of the month when the payment is deducted from your account.', }} />
Transform to a backend format#
Internally the field works with clean values – a number (1–28) or 'last'. When the backend expects a different wire format, such as a fixed two-digit day ('01'–'28') with a sentinel for the last day of the month, use transformOut to convert the value at the API boundary. The converted value is what gets stored in the form data and passed to onChange and onSubmit. Use transformIn to convert incoming data (for example initial values) back to the field's internal value so it displays correctly.
// The field works with clean values internally: a number (1–28) // or 'last'. At the API boundary we convert to the wire format the // backend expects – a fixed two-digit day ('01'–'28') and a sentinel // for the last day of the month. const transformOut = (internal) => { if (internal === 'last') { return 'last-day' } if (typeof internal === 'number') { return String(internal).padStart(2, '0') } } // Convert the backend format back to the field's internal value // so it displays correctly. const transformIn = (external) => { if (external === 'last-day') { return 'last' } if (external != null && external !== '') { return Number(external) } } render( <Form.Handler defaultData={{ installmentDay: '01', }} onSubmit={(data) => console.log('onSubmit', data)} > <Field.InstallmentDay path="/installmentDay" transformIn={transformIn} transformOut={transformOut} onChange={(value) => console.log('onChange', value)} /> <Form.SubmitButton top="small" /> <Tools.Log top="small" /> </Form.Handler> )