Skip to main content
Version: 1.1.12

Language Select

info

A component that allows users to select a language from a list. Supports displaying languages in their native form and provides various customization options.

Usage​

import React, { useState } from "react";
import { LanguageSelect } from "react-country-state-city";
import "react-country-state-city/dist/react-country-state-city.css";

export default function App() {
const [language, setLanguage] = useState(null);

return (
<div>
<h6>Language</h6>
<LanguageSelect
containerClassName="form-group"
inputClassName=""
onChange={(_lan) => setLanguage(_lan)}
onTextChange={(_txt) => console.log(_txt)}
defaultValue={language}
placeHolder="Select Language"
/>
</div>
);
}

Live Example​

Language

Props​

PropTypeDefaultRequiredDescription
srcstring""❌The relative or absolute URL where the data files are hosted. Default is a hosted CDN.
displayNativebooleanfalse❌If true, displays languages in their native form; otherwise, displays them in English.
defaultValueLanguage | string(name)null❌The current selected language object or language name.
containerClassNamestring""❌CSS class for styling the container.
inputClassNamestring""❌CSS class for styling the input box.
onChange(language: Language) => voidundefined❌Callback function triggered when the selected language changes.
onTextChange(text: string) => voidundefined❌Callback function triggered when the input text changes.
placeHolderstring""❌Placeholder text displayed in the input when empty.