
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
geo-autocomplete-form
Advanced tools
`GeoAutocompleteForm` is a React component that allows users to autofill geolocation information based on the input of a city and country. It utilizes the Google Maps API (Places Library) and Ant Design for UI elements.
GeoAutocompleteForm
is a React component that allows users to autofill geolocation information based on the input of a city and country. It utilizes the Google Maps API (Places Library) and Ant Design for UI elements.
yarn add antd @react-google-maps/api
AutoCompleteComponentProps
Prop Name | Type | Default Value | Description |
---|---|---|---|
API_KEY | string | undefined | Your Google Maps API Key. Required to load the Places Library. |
onFinish | (address: Address) => void | undefined | Callback function triggered on form submission, returning the selected address information. |
formRowGutter | Gutter or [Gutter, Gutter] | [10, 10] | Gutter size for the layout grid of the form. |
countyColSpan | `number | string` | 24 |
cityColSpan | `number | string` | 24 |
submitColSpan | `number | string` | 24 |
cityClassName | string | undefined | CSS class for the city input field. |
countryClassName | string | undefined | CSS class for the country input field. |
submitClassName | string | undefined | CSS class for the submit button. |
cityStyle | React.CSSProperties | undefined | Inline style for the city input field. |
countryStyle | React.CSSProperties | undefined | Inline style for the country input field. |
submitStyle | React.CSSProperties | undefined | Inline style for the submit button. |
cityPlaceholder | string | 'Select city' | Placeholder text for the city input field. |
countryPlaceholder | string | 'Select country' | Placeholder text for the country input field. |
submitText | string | 'Submit' | Text to display on the submit button. |
loading | boolean | undefined | Shows a loading state if set to true. |
rowWrapperClassName | string | undefined | CSS class for the wrapper row element. |
rowWrapperStyle | React.CSSProperties | undefined | Inline style for the wrapper row element. |
cityColClassName | string | undefined | CSS class for the column containing the city input field. |
cityColStyle | React.CSSProperties | undefined | Inline style for the column containing the city input field. |
countryColClassName | string | undefined | CSS class for the column containing the country input field. |
countryColStyle | React.CSSProperties | undefined | Inline style for the column containing the country input field. |
submitColClassName | string | undefined | CSS class for the column containing the submit button. |
submitColStyle | React.CSSProperties | undefined | Inline style for the column containing the submit button. |
citySkeletonClassName | string | undefined | CSS class for the skeleton loader of the city input field. |
citySkeletonStyle | React.CSSProperties | undefined | Inline style for the skeleton loader of the city input field. |
countrySkeletonClassName | string | undefined | CSS class for the skeleton loader of the country input field. |
countrySkeletonStyle | React.CSSProperties | undefined | Inline style for the skeleton loader of the country input field. |
submitSkeletonClassName | string | undefined | CSS class for the skeleton loader of the submit button. |
submitSkeletonStyle | React.CSSProperties | undefined | Inline style for the skeleton loader of the submit button. |
Address
ObjectThe Address
object returned in the onFinish
callback contains the following properties:
Property | Type | Description |
---|---|---|
name | string | Full formatted address. |
city | string | Name of the selected city. |
country | string | Name of the selected country. |
latitude | number | Latitude coordinate of the location. |
longitude | number | Longitude coordinate of the location. |
import React from 'react';
import GeoAutocompleteForm from './GeoAutocompleteForm';
const MyComponent = () => {
const handleFinish = (address) => {
console.log('Selected Address:', address);
};
return (
<GeoAutocompleteForm
API_KEY="YOUR_GOOGLE_MAPS_API_KEY"
onFinish={handleFinish}
/>
);
};
export default MyComponent;
API_KEY
is missing, the component will display a message asking the user to provide a valid Google Maps API key.Skeletons are displayed while the Google Maps API is loading or if the loading
prop is set to true. You can customize the skeleton styles with the citySkeletonClassName
, countrySkeletonClassName
, and submitSkeletonClassName
props.
This project is licensed under the MIT License.
FAQs
`GeoAutocompleteForm` is a React component that allows users to autofill geolocation information based on the input of a city and country. It utilizes the Google Maps API (Places Library) and Ant Design for UI elements.
The npm package geo-autocomplete-form receives a total of 0 weekly downloads. As such, geo-autocomplete-form popularity was classified as not popular.
We found that geo-autocomplete-form demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.