npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@crow281/mui-locale-autocomplete

v1.0.0

Published

A widget library built over Material UI providing extensions of Autocomplete designed to support selecting a locale.

Downloads

10

Readme

mui-locale-autocomplete

Introduction

LocaleAutocomplete

A widget library built over Material UI providing extensions of Autocomplete designed to support selecting a locale.

You can access the github project here.

Installation

Get @crow281/mui-locale-autocomplete from NPM:

npm i --save @crow281/mui-locale-autocomplete

@crow281/mui-locale-autocomplete is also dependent on Material UI and Material Icons as peer dependencies:

npm i --save @mui/icons-material @mui/material @emotion/styled @emotion/react

If you want to be able to use I18nextAutocomplete, you will need to install react-i18next and i18next:

npm i --save react-i18next i18next

Documentation

The API documentation is available here.

Demo

The sample project is here.

You can view a live demo here.

Sample Code

Here are some quick samples to show you how the widgets can be used.

LocaleAutocomplete

LocaleAutocomplete is a basic class in need of setup.

import { LocaleAutocomplete } from "@crow281/mui-locale-autocomplete";
import { useState } from "react";

/**
 * Displays LocaleAutocomplete in action.
 */
export function LocaleAutocompleteDemo(): JSX.Element {
    //Currently selected locale.
    const [selectedLocale, setSelectedLocale] = useState("Null");

    //List of locales user can pick from.
    const locales: Intl.Locale[] = [
        new Intl.Locale("en"),
        new Intl.Locale("en-GB"),
        new Intl.Locale("en-US"),
        new Intl.Locale("es"),
    ];

    //Function called whenever locale is changed.
    const onChange = (
        event: React.SyntheticEvent<Element, Event>,
        value: Intl.Locale | null,
    ): void => {
        //Records string value of locale.
        let localeString: string;

        //Update currently selected locale.
        //If a locale was selected.
        if (value) {
            //Convert to string.
            localeString = value.baseName;

            //If nothing was selected.
        } else {
            //Tell user selected locale is null.
            localeString = "Null";
        }

        //Update the selected locale.
        setSelectedLocale(localeString);
    };

    return (
        <div>
            <LocaleAutocomplete options={locales} onChange={onChange} />
            <div>Selected Locale: {selectedLocale}</div>
        </div>
    );
}

I18nextAutocomplete

I18nextAutocomplete automatically binds to I18next, so just putting the element where it is needed is enough.

import { I18nextAutocomplete } from "@crow281/mui-locale-autocomplete";
import { useTranslation } from "react-i18next";

/**
 *
 * @returns
 * Widget demonstrating I18nextAutocomplete
 */
export function I18nextAutocompleteDemo() {
    //Fetch localization.
    const { t, i18n } = useTranslation();

    return (
        <div>
            <I18nextAutocomplete />
            <br />
            <div
                style={{
                    textAlign: "left",
                }}
            >
                Selected Locale: {i18n.language}
            </div>
            <table
                style={{
                    border: "1px solid black",
                }}
            >
                <thead>
                    <tr>
                        <th>Localization Key</th>
                        <th>Translated Value</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>"example.goodbye"</td>
                        <td>{t("example.goodbye")}</td>
                    </tr>
                    <tr>
                        <td>"example.goodDay"</td>
                        <td>{t("example.goodDay")}</td>
                    </tr>
                    <tr>
                        <td>"example.helloWorld"</td>
                        <td>{t("example.helloWorld")}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    );
}