react-google-autocomplete icon indicating copy to clipboard operation
react-google-autocomplete copied to clipboard

How to style the Dropdown with google suggestions?

Open Razifmalik opened this issue 2 years ago • 1 comments

How can we style the actual dropdown with the google suggestions? I cannot find any props to do that. Ideally I would like to use tailwind to make it responsive for different screen sizes. Here is my current code as I do not know on how to style the dropdown. I cannot find anything in the documentation either -

<div className="flex items-center bg-gray-200 border border-gray-300 rounded-full p-2 mx-2"> <FontAwesomeIcon icon={faSearch} className="mr-2 text-gray-600" /> <Autocomplete //className=" flex-1 w-full appearance-none outline-none text-gray-700" style={{ width: "1250px", backgroundColor: "lightblue" }} ref={inputRef} apiKey={"API-Key"} onPlaceSelected={(selected, a, c) => { console.log(selected); }} options={{ types: ["geocode", "establishment"], componentRestrictions: { country }, offset: 2, }} defaultValue="Moscow" /> </div> Screenshot 2023-11-17 at 12 37 31

Razifmalik avatar Nov 17 '23 11:11 Razifmalik

If you want custom styling you need to implement your own input/dropdown using the hooks provided.

https://www.npmjs.com/package/react-google-autocomplete#useplacesautocompleteservice

nstanard avatar Jul 10 '24 14:07 nstanard