The project is in a healthy, maintained state
A prefecture dropdown backed by the JIS X 0401 code table (1..47), packaged as a Funicular plugin gem. The data module is CRuby-safe for server-side lookups.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 0.4.0
 Project Readme

funicular-japan-prefectures

A Japan prefecture dropdown for Funicular, packaged as a plugin gem. Ships the JIS X 0401 code table (1..47) as data shared by the client component and server-side lookups.

Installation

# Gemfile
group :funicular do
  gem "funicular-japan-prefectures"
end

The component sources are prepended to your client bundle by funicular:compile, and funicular_plugin_include_tags serves the stylesheet.

Usage

component Funicular::Plugins::JapanPrefectures::Component,
          value: prefecture_id,          # optional preselected JIS code
          select_id: "address-prefecture",
          select_class: "border rounded px-3 py-2",
          prompt: "選択してください",
          on_change: ->(id) { @prefecture_id = id }
  • Controlled component: the parent owns value and re-renders after on_change, which receives the Integer JIS code (nil for the blank prompt option).
  • prompt — label of the blank option (default: 都道府県).
  • select_id / select_class — presentation knobs.

Server-side data

The code table has no Funicular dependency, so Rails code (mailers, PDFs, plain ERB forms) can use the same source of truth:

require "japan_prefectures/data"

Funicular::Plugins::JapanPrefectures.name_of(13)        # => "東京都"
Funicular::Plugins::JapanPrefectures.id_of("東京都")    # => 13
Funicular::Plugins::JapanPrefectures.valid_id?(48)      # => false
Funicular::Plugins::JapanPrefectures.select_options     # => [["北海道", 1], ...]

Test

bundle install && npm install
bundle exec rake test