Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can i restrict a countrie? #333

Closed
Amstrong opened this issue Jun 16, 2020 · 2 comments
Closed

Can i restrict a countrie? #333

Amstrong opened this issue Jun 16, 2020 · 2 comments

Comments

@Amstrong
Copy link

I'm currently trying to get my autocomplete to restrict only one country. I have tried to find the form with the example but there is no documentation of this.

For this reason I would like to know if it is possible. Thank you.

@briansmith-fr
Copy link

Yes it is possible: For example, to return cities in Canada,

          <PlacesAutocomplete
            value={this.state.address}
            onChange={this.handleChange}
            onSelect={this.handleSelect}
            searchOptions={{
              componentRestrictions: {
                country: ["ca"],
              },
              types: ["(cities)"],
            }}
          >

For USA, use ...country: ["us"],...

Regards,
Brian

@Amstrong
Copy link
Author

Thank you very much Brian, it was very helpful for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants