<Autocomplete id="google-map-demo" defaultValue={userData.addressLine1 || ''} freeSolo // <-- Add this line clearOnEscape={false} clearIcon={null} // ...rest of your props /> onChange={(event: any, newValue: PlaceType | string | null) => { if (typeof newValue === 'string') { // The user entered a new address manually setAddress(newValue); console.log('Manual input:', newValue); } else if (newValue) { // The user selected an address from the dropdown setAddress(newValue.description); console.log('Selected Value:', newValue.description); } }}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter