Skip to main content

Basic Information Block

BasicInformation is a controlled address and contact form block built on MUI.

Installation​

npm install @nodeblocks/frontend-basic-information-block

What You Need​

ItemWhy it matters
dataSingle source of truth for form state (NameInput, FuriganaInput, PostalCodeInput, PrefectureSelect, etc.)
onDataChangeReceives updated state plus metadata for validation, analytics, or side effects
errors (optional)Field errors keyed by field path
labels (optional)Root copy for title, subtitle, field labels, search button text, and submit text
placeholders (optional)Root placeholder copy for text fields and the select
selectOptions (optional)Overrides the prefecture select options
onSearchAddressClick (optional)Handles the postal code search button
blockSpacingBefore (optional)Adds custom spacing before named blocks in the default or override layout
Controlled component

BasicInformation does not own form state. Keep state in your app and pass it through data. The default shape includes NameInput, FuriganaInput, PostalCodeInput, PrefectureSelect, CityInput, AddressInput, and PhoneInput.

Code Examples​

Live Editor
function Example() {
  const defaultData = {
    NameInput: '',
    FuriganaInput: '',
    PostalCodeInput: '',
    PrefectureSelect: '',
    CityInput: '',
    AddressInput: '',
    PhoneInput: '',
  };

  const [data, setData] = React.useState(defaultData);

  return (
    <BasicInformation
      data={data}
      onDataChange={setData}
      onSearchAddressClick={() => {
        setData((current) => ({ ...current }));
      }}
      onSubmit={(event) => {
        event.preventDefault();
        setData((current) => ({ ...current }));
      }}
    />
  );
}
Result
Loading...

Important Props​

Core Props​

PropTypeRequiredDefaultDescription
dataBasicInformationFormData ({ NameInput, FuriganaInput, PostalCodeInput, PrefectureSelect, CityInput, AddressInput, PhoneInput } or extended Record<string, unknown>)Yes-Controlled form data object
onDataChange(data, meta) => voidYes-Called on updates; meta includes name, value, cause (input, change, blur, clear, reset, programmatic), and optional event
errors{ [fieldName: string]: string | string[] }NoundefinedField errors keyed by field path; common keys are NameInput, FuriganaInput, PostalCodeInput, PrefectureSelect, CityInput, AddressInput, and PhoneInput

Content Props​

PropTypeRequiredDefaultDescription
labels{ title?, subtitle?, nameInput?, furiganaInput?, postalCodeInput?, searchAddressButton?, prefectureSelect?, cityInput?, addressInput?, phoneInput?, submitButton? }Notitle: 'ćŸșæœŹæƒ…ć ±', subtitle: '* は濅須äș‹é …です', nameInput: 'æ°ć', furiganaInput: 'フăƒȘガナ', postalCodeInput: 'éƒ”äŸżç•Șć·', searchAddressButton: 'äœæ‰€ă‚’æ€œçŽą', prefectureSelect: '郜道ćșœçœŒ', cityInput: '澂ćŒșç”ș村', addressInput: 'ç”șćăƒ»ç•Șćœ°ăƒ»ć»ș物', phoneInput: 'é€Łç”Ąć…ˆé›»è©±ç•Șć·', submitButton: 'æŹĄăž'Root copy for the title, helper text, field labels, search button, and submit button
placeholders{ nameInput?, furiganaInput?, postalCodeInput?, prefectureSelect?, cityInput?, addressInput?, phoneInput? }NonameInput: 'æ°ćă‚’ć…„ćŠ›', furiganaInput: 'フăƒȘă‚ŹăƒŠă‚’ć…„ćŠ›', postalCodeInput: 'éƒ”äŸżç•Șć·ă‚’ć…„ćŠ›', prefectureSelect: '郜道ćșœçœŒă‚’遞択', cityInput: '澂ćŒșç”șæ‘ă‚’ć…„ćŠ›', addressInput: 'ç”șćăƒ»ç•Șćœ°ăƒ»ć»ș物を慄抛', phoneInput: '電話ç•Șć·ă‚’ć…„ćŠ›ïŒˆăƒă‚€ăƒ•ăƒłăȘă—ă§ć…„ćŠ›ïŒ‰'Root placeholder copy for the text inputs and select
selectOptions{ prefectureSelect?: { value: string; label: string }[] }NoPREFECTURESOverrides the options shown in the prefecture select
onSearchAddressClickMouseEventHandler<HTMLButtonElement>NoundefinedEnables the postal-code search button and runs when the user clicks it

Layout and Composition Props​

PropTypeRequiredDefaultDescription
componentStackProps<'form'>['component']No'form'Root container element
childrenReactNode or block override functionNoundefinedPass JSX children for compound components, or a function to override blocks
blockSpacingBeforePartial<Record<string, number | { xs?: number; sm?: number; md?: number; lg?: number; xl?: number }>>No{ subtitle: 4, nameInput: { xs: 4, sm: 3 }, submitButton: 4 }Extra spacing before selected blocks
classNamestringNoundefinedAdditional class name on the root container
sxStackProps<'form'>['sx']NoundefinedMUI sx styling for the root container

Inherits StackProps<'form'> props except children. When using block overrides, the default block order is title, subtitle, nameInput, furiganaInput, postalCodeInput, prefectureSelect, cityInput, addressInput, phoneInput, submitButton, input.

Default UI Blocks​

BlockMUI base component(s)Notes
BasicInformationStackRoot form container; defaults to component="form" with built-in padding and vertical spacing
TitleTypographyDefault copy is ćŸșæœŹæƒ…ć ±
SubtitleTypographyDefault copy is * は濅須äș‹é …です
NameInputTextFieldname="NameInput", default label æ°ć, default placeholder æ°ćă‚’ć…„ćŠ›
FuriganaInputTextFieldname="FuriganaInput", default label フăƒȘガナ, default placeholder フăƒȘă‚ŹăƒŠă‚’ć…„ćŠ›
PostalCodeInputTextField + Buttonname="PostalCodeInput", default label éƒ”äŸżç•Șć·, default placeholder éƒ”äŸżç•Șć·ă‚’ć…„ćŠ›, inputMode="numeric", search button text defaults to äœæ‰€ă‚’æ€œçŽą when onSearchAddressClick is present
PrefectureSelectFormControl + InputLabel + Select + MenuItemname="PrefectureSelect", default label 郜道ćșœçœŒ, default placeholder 郜道ćșœçœŒă‚’遞択, options default to PREFECTURES
CityInputTextFieldname="CityInput", default label 澂ćŒșç”ș村, default placeholder 澂ćŒșç”șæ‘ă‚’ć…„ćŠ›
AddressInputTextFieldname="AddressInput", default label ç”șćăƒ»ç•Șćœ°ăƒ»ć»ș物, default placeholder ç”șćăƒ»ç•Șćœ°ăƒ»ć»ș物を慄抛
PhoneInputTextFieldname="PhoneInput", default label é€Łç”Ąć…ˆé›»è©±ç•Șć·, default placeholder 電話ç•Șć·ă‚’ć…„ćŠ›ïŒˆăƒă‚€ăƒ•ăƒłăȘă—ă§ć…„ćŠ›ïŒ‰, inputMode="numeric"
SubmitButtonButtonDefault copy is æŹĄăž

Extra field primitives​

PrimitiveMUI base component(s)Notes
InputTextFieldInternal field primitive exposed as BasicInformation.Input for custom flows and overrides

TypeScript​

export type BasicInformationFormData =
| {
NameInput: string;
FuriganaInput: string;
PostalCodeInput: string;
PrefectureSelect: string;
CityInput: string;
AddressInput: string;
PhoneInput: string;
}
| Record<string, unknown>;