Skip to content

Commit bd8941c

Browse files
committed
docs: add worldwide city search example
1 parent 19edf6b commit bd8941c

22 files changed

Lines changed: 132 additions & 3 deletions
File renamed without changes.
File renamed without changes.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# PlaceKit Autocomplete React city field example
2+
3+
[![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?style=flat-square&logo=codesandbox)](https://githubbox.com/placekit/autocomplete-react/tree/main/examples/autocomplete-react-cities)
4+
5+
Make a worldwide city selector field with Autocomplete React.
6+
7+
Only using [TailwindCSS](https://tailwindcss.com) as a convenience for the basic styling of the example.
8+
9+
## Run
10+
11+
```sh
12+
# clone project and access this example
13+
git clone git@github.com:placekit/autocomplete-react.git
14+
cd autocomplete-react/examples/autocomplete-react-cities
15+
16+
# install dependencies
17+
npm install
18+
19+
# create .env file
20+
cp .env.sample .env
21+
```
22+
23+
Open the `.env` file and replace `<your-api-key>` with your PlaceKit API key.
24+
25+
Then run:
26+
27+
```sh
28+
npm run dev
29+
```
30+
31+
And your project will be served at http://localhost:5173.
File renamed without changes.

examples/autocomplete-react-country/postcss.config.cjs renamed to examples/autocomplete-react-cities/postcss.config.cjs

File renamed without changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { PlaceKit } from '@placekit/autocomplete-react';
2+
3+
const App = () => {
4+
return (
5+
<div className="flex items-center justify-center">
6+
<PlaceKit
7+
apiKey={import.meta.env.VITE_PLACEKIT_API_KEY}
8+
geolocation={false}
9+
options={{
10+
types: ['city'],
11+
countrySelect: false,
12+
}}
13+
className="w-96"
14+
/>
15+
</div>
16+
);
17+
};
18+
19+
export default App;
File renamed without changes.
File renamed without changes.
File renamed without changes.

examples/autocomplete-react-country/tailwind.config.js renamed to examples/autocomplete-react-cities/tailwind.config.js

File renamed without changes.

0 commit comments

Comments
 (0)