Shadcn Country Region Select

screenshot of Shadcn Country Region Select
nextjs
react
tailwind
cmdk

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.

Overview

The Shadcn Country & Region Select is an elegantly designed select input component that seamlessly integrates into the Shadcn design system. Built with customization in mind, this component caters to both developers and users looking for a visually appealing and functional way to select countries and regions. Its modern aesthetics and user-friendly features make it a standout choice for any project requiring geographical selection.

Having recognized the lack of such components within the Shadcn ecosystem, I took it upon myself to create one, hoping it would fill a gap for those needing an intuitive country-region selector. This component not only simplifies the selection process but also adheres to Shadcn’s commitment to a sleek design, making it a valuable addition to any web application.

Features

  • Customizable ClassName: Accepts a customizable class string, allowing for easy integration into your design without altering its core functionality.
  • Dynamic onChange Callback: Fires a callback function every time the select value changes, ensuring that your application can react appropriately to user selections.
  • Versatile Placeholders: Default placeholders, "Country" for countries and "Region" for regions, guide users through the selection process while remaining easy to modify.
  • Priority Options: Supports an array of prioritized countries or regions, letting you ensure that the most frequently chosen options appear at the top of the list.
  • Whitelist Functionality: Offers an array of allowed countries and regions, letting you restrict selection to a particular set of options based on your project's needs.
  • Blacklist Capability: Provides a way to ban certain countries or regions from being selected, ensuring that users avoid making undesirable choices.
  • Integration Ready: Designed to fit seamlessly into any project utilizing the Shadcn design system, enhancing the overall user experience without any hassle.

This Shadcn Country & Region Select component is both a powerful tool for developers and a pleasant experience for end-users, making it essential for any project that requires location selection.

nextjs
Next.js

Next.js is a React-based web framework that enables server-side rendering, static site generation, and other powerful features for building modern web applications.

react
React

React is a widely used JavaScript library for building user interfaces and single-page applications. It follows a component-based architecture and uses a virtual DOM to efficiently update and render UI components

tailwind
Tailwind

Tailwind CSS is a utility-first CSS framework that provides pre-defined classes for building responsive and customizable user interfaces.

cmdk
cmdk

cmdk is a fast, composable command menu component for React. It provides the foundation for building command palettes, search interfaces, and keyboard-navigable menus similar to those found in applications like VS Code, Linear, and Raycast.

contentlayer
Contentlayer

Contentlayer is an open-source platform for building dynamic, data-driven websites and applications using markdown files as the content source. It features an intuitive API, flexible content modeling, and easy integration with popular frontend frameworks and tools.

eslint
Eslint

ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.

framer-motion
Framer Motion

Alpine.js is a lightweight JavaScript framework that simplifies the process of creating dynamic, reactive user interfaces on the web. It uses a declarative syntax that offers a higher level of abstraction compared to vanilla JavaScript, while being more performant and easier to use than jQuery.

postcss
Postcss

PostCSS is a popular open-source tool that enables web developers to transform CSS styles with JavaScript plugins. It allows for efficient processing of CSS styles, from applying vendor prefixes to improving browser compatibility, ultimately resulting in cleaner, faster, and more maintainable code.

react-hook-form
React Hook Form

React Hook Form is a performant, flexible, and extensible form library for React with easy validation. It reduces re-renders and improves performance by using uncontrolled components and native HTML validation, making form handling simple and efficient.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.

zod
Zod

Zod is a TypeScript-first schema declaration and validation library. It allows you to define schemas that can validate data at runtime while providing excellent TypeScript inference, making it perfect for API validation, form validation, and type-safe data handling.