0.0.12 • Published 13 days ago

shadcn-country-region-select v0.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
13 days ago

Shadcn country region select

Shadcn Country & Region Select is a select input component built as part of the Shadcn design system. It offers a blend of customization and out-of-the-box styling, adhering to Shadcn's sleek and modern design principles.

Why

I needed a country - region select component for a project. I looked around for any country - region select components that used Shadcn's design system, but I couldn't find any. So, I decided to make one myself. I hope you find it useful!

!WARNING Before you dive in, just double-check that you're using installing the shadcn correctly!

Usage

import { useState } from "react"
import { CountrySelect, RegionSelect } from "shadcn-country-region-select";

function App() {
  const [countryCode, setCountryCode] = useState("");

  return (
    <div className="flex items-center flex-col w-full mt-20">
      <CountrySelect
        classname="w-[180px]"
        onChange={(value) => setCountryCode(value)}
        priorityOptions={["US"]}
        placeholder="Country"
      ></CountrySelect>
      <RegionSelect
        onChange={(value) => console.log(value)}
        classname="w-[180px] mt-2"
        countryCode={countryCode}
      ></RegionSelect>
    </div>

CountrySelect properties

PropTypeDescription
classnameobjectconfiguration object for the manifest
onChangefunccallback function fired when the select value changed
placeholderstringplaceholder value, default "Country"
priorityOptionsstring[]Array of countries prioritized in the select list
whiteListstring[]Array of allowed countries
blackListstring[]Array of banned countries

RegionSelect properties

PropTypeDescription
classnamestringaccept a class string
onChangefunccallback function fired when the select value changed
placeholderstringplaceholder value, default "Region"
priorityOptionsstring[]Array of regions prioritized in the select list
whiteListstring[]Array of allowed regions
blackListstring[]Array of banned regions
0.0.12

13 days ago

0.0.11

14 days ago

0.0.10

14 days ago