tiny-location-input
A tiny, customizable React location input with autocomplete using GeoNames data.
📦 Installation
npm install tiny-location-input
🚀 Usage
import LocationInput from 'tiny-location-input';
function App() {
const handleLocationChange = (location) => {
console.log('Selected location:', location);
};
return (
<LocationInput
onSelect={handleLocationChange}
classNames={{ container: 'shadow-container' }}
styles={{ input: { fontSize: '1.2rem' } }}
/>
);
}
✨ Features
- Inline styles with override support via props
- Lightweight: no external CSS or dependencies
- Fully React-compatible with TypeScript support
🛠 Props
Prop | Type | Description |
---|---|---|
onSelect | Function | Called with the selected location object |
classNames | Object | Optional class names for each component part |
styles | Object | Optional inline styles for each part |
placeholder | String | Input placeholder text |
📄 License
MIT