TELPICK
Telpick for country and phone codes with IP detection. TelpickZone for IANA timezones with search by country, city or zone. React, Vue 3, Vanilla JS and CDN.
Install with npm
npm install telpick
Install with pnpm
pnpm add telpick
Install with yarn
yarn add telpick
Include from CDN
<script src="https://unpkg.com/telpick@latest/dist/telpick.umd.js"></script>
Click on the selector to try it. The component automatically detects your country by IP.
Search by country, city, or IANA timezone. Your browser timezone is selected automatically.
After installing the package, import the CSS styles and the component according to your framework.
# Install the packagenpm install telpick# Import CSS styles (required)import 'telpick/dist/style.css'# Import componentimport { TelpickReact } from 'telpick/react'
// React Componentimport React, { useState } from 'react'import { TelpickReact } from 'telpick/react'import 'telpick/dist/style.css'function App() { const [selectedCountry, setSelectedCountry] = useState(null) return ( <TelpickReact code={null} onChange={(country) => { console.log('Selected country:', country) setSelectedCountry(country) }} /> )}
<!-- Vue 3 Component --><template> <TelpickVue :code="selectedCode" @update:code="handleCountryChange" /></template><script setup>import { ref } from 'vue'import { TelpickVue } from 'telpick/vue'import 'telpick/dist/style.css'const selectedCode = ref(null)const handleCountryChange = (country) => { console.log('Selected country:', country) selectedCode.value = country.country_code}</script>
<!-- HTML --><link rel="stylesheet" href="https://unpkg.com/telpick@latest/dist/style.css"><div id="telpick-container"></div><script src="https://unpkg.com/telpick@latest/dist/telpick.umd.js"></script>// JavaScriptconst telpick = new Telpick({ code: null, onChange: (country) => { console.log('Selected country:', country) }})telpick.init(document.getElementById('telpick-container'))
Timezone selector with the same API style. Search by country, city, or IANA timezone.
# Install the packagenpm install telpick# Import CSS styles (required)import 'telpick/dist/style.css'# Import componentimport { TelpickZoneReact } from 'telpick/zone/react'
// React Componentimport React, { useState } from 'react'import { TelpickZoneReact } from 'telpick/zone/react'import 'telpick/dist/style.css'function App() { const [selectedZone, setSelectedZone] = useState(null) return ( <TelpickZoneReact timezone={null} onChange={(zone) => { console.log('Selected timezone:', zone) setSelectedZone(zone) }} /> )}
<!-- Vue 3 Component --><template> <TelpickZoneVue :timezone="selectedTimezone" @update:timezone="handleTimezoneChange" /></template><script setup>import { ref } from 'vue'import { TelpickZoneVue } from 'telpick/zone/vue'import 'telpick/dist/style.css'const selectedTimezone = ref(null)const handleTimezoneChange = (zone) => { console.log('Selected timezone:', zone) selectedTimezone.value = zone.id}</script>
<!-- HTML --><link rel="stylesheet" href="https://unpkg.com/telpick@latest/dist/style.css"><div id="telpick-zone-container"></div><script src="https://unpkg.com/telpick@latest/dist/telpick-zone.umd.js"></script>// JavaScriptconst telpickZone = new TelpickZone({ timezone: null, onChange: (zone) => { console.log('Selected timezone:', zone.id, zone.offset) }})telpickZone.init(document.getElementById('telpick-zone-container'))
When the user selects a timezone, onChange (React/Vanilla) or @update:timezone (Vue) receives this object:
{ id: "America/Lima", city: "Lima", country: "Perú", country_code: "PE", continent: "America", flag: "/flags/pe.webp", offset: "GMT-5"}