PHPackages                             ranium/filament-flags-dropdown - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ranium/filament-flags-dropdown

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ranium/filament-flags-dropdown
==============================

Flag dropdown field for Filament forms

v0.2.0(2y ago)110[2 PRs](https://github.com/ranium/filament-flags-dropdown/pulls)MITBladePHP ^8.1

Since Jul 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ranium/filament-flags-dropdown)[ Packagist](https://packagist.org/packages/ranium/filament-flags-dropdown)[ Docs](https://github.com/ranium/filament-flags-dropdown)[ RSS](/packages/ranium-filament-flags-dropdown/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (13)Versions (7)Used By (0)

Flags dropdown field for Filament forms
=======================================

[](#flags-dropdown-field-for-filament-forms)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0bacd53c16968b2118d33bd0c39a85ffc18fb137f4f0a9fbba9538b9f0f489bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72616e69756d2f66696c616d656e742d666c6167732d64726f70646f776e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ranium/filament-flags-dropdown)[![GitHub Tests Action Status](https://camo.githubusercontent.com/522bf78357d777abd108bc5bbd48c39964f43c12a8a72a50164e60bc719549f5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72616e69756d2f66696c616d656e742d666c6167732d64726f70646f776e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ranium/filament-flags-dropdown/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/69db61ac50117d848826cfc673e291487d9b496e78af0e44fe7ff6b410b94917/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72616e69756d2f66696c616d656e742d666c6167732d64726f70646f776e2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/ranium/filament-flags-dropdown/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/ae2cca936a0bfae1f935e493a636c5ff8033796e61716e3c7235999cd54cef18/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616e69756d2f66696c616d656e742d666c6167732d64726f70646f776e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ranium/filament-flags-dropdown)

A dropdown field with flags and custom labels. The field can be used as a country or language selector in [Filament forms](https://filamentphp.com/docs/2.x/forms/installation).

This package utilizes [flag-icons](https://github.com/lipis/flag-icons) to display the country flags.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require ranium/filament-flags-dropdown
```

You can publish the config file with (optional):

```
php artisan vendor:publish --tag="filament-flags-dropdown-config"
```

Usage
-----

[](#usage)

You can now use the FlagsDropdown field in your form builder. You need to provide the options to display in the dropdown.

The options array keys should be the [ISO 3166-1-alpha-2 code](https://www.iso.org/obp/ui/#search/code/) of the country and the value should be an array of `value` and `label` for the option. In the following example, `IND`will be saved in the database when `India` is chosen from the dropdown.

```
use Ranium\FlagsDropdown\Forms\Components\Fields\FlagsDropdown;

public static function form(Form $form): Form
{
    $countries = [
        'in' => ['value' => 'IND', 'label' => 'India'],
        'us' => ['value' => 'USA', 'label' => 'United States'],
    ];

    return $form
        ->schema([
            // ... Other fields
            FlagsDropdown::make('country')
                ->options($countries), // Chain your field modifiers here
            // Other fields
        ]);
}
```

If you want the dropdown to have the same `value` as the `label` then your options can be built like this:

```
$countries = [
    'in' => 'India',
    'us' => 'United States'
];
```

In this case the field's value will be "India" when that option is chosen.

### Events

[](#events)

The field fires an event whenever its value is changed. You can listen to the event and bind it to a callable. The new and old values are passed as arguments to the callable.

```
use Filament\Pages\Page;
use Filament\Forms\Concerns\InteractsWithForms;
use Ranium\FlagsDropdown\Forms\Components\Fields\FlagsDropdown;

class Settings extends Page
{
    use InteractsWithForms;

    protected static ?string $navigationIcon = 'heroicon-o-document-text';

    protected static string $view = 'filament.pages.settings';

    protected function getFormSchema(): array
    {
        return [
            FlagsDropdown::make('language')
                ->options(['in' => 'Hindi', 'gb' => 'English'])
                ->onChange($this->doSomething(...)),
        ];
    }

    public function doSomething(?string $newValue, ?string $oldValue)
    {
        // This method will be called whenever the value of the
        // dropdown changes in the frontend
    }
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Abbas Ali](https://github.com/abbasali)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

2

Last Release

1041d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/139e699b6ff33ee0232b57559daca8b1eeae1627bfbb2aa9f5146eb27423800a?d=identicon)[ranium](/maintainers/ranium)

---

Top Contributors

[![abbasali](https://avatars.githubusercontent.com/u/145739?v=4)](https://github.com/abbasali "abbasali (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelraniumfilament-flags-dropdown

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ranium-filament-flags-dropdown/health.svg)

```
[![Health](https://phpackages.com/badges/ranium-filament-flags-dropdown/health.svg)](https://phpackages.com/packages/ranium-filament-flags-dropdown)
```

###  Alternatives

[guava/calendar

Adds support for vkurko/calendar to Filament PHP.

298241.0k3](/packages/guava-calendar)[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[creagia/filament-code-field

A Filamentphp input field to edit or view code data.

58289.3k3](/packages/creagia-filament-code-field)[swisnl/filament-backgrounds

Beautiful backgrounds for Filament auth pages

54149.2k6](/packages/swisnl-filament-backgrounds)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
