Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
H

hotwire_combobox

> 编程语言
Open source

An accessible autocomplete for Ruby on Rails.

651 stars0 likes4 views
WebsiteGitHub

About

An accessible autocomplete for Ruby on Rails.

Easy and Accessible Autocomplete for Ruby on Rails

[!IMPORTANT] HotwireCombobox is at an early stage of development. It's nearing a beta release, but the API might change and bugs are expected. Please continue to use the library and report any issues in the GitHub repo.

Installation

First, make sure Turbo and Stimulus are configured and running properly on your app.

Then, add this line to your application's Gemfile and run bundle install:

ruby
gem "hotwire_combobox"

Finally, configure your assets:

Configuring JS

Before continuing, you should know whether your app is using importmaps or JS bundling.

Importmaps

Most apps using importmaps won't need any configuration. If things aren't working for you, read on.

In app/javascript/controllers/index.js you should have one of the following:

Either,

javascript
import { application } from "controllers/application"
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
eagerLoadControllersFrom("controllers", application)

Or,

javascript
import { application } from "controllers/application"
import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
lazyLoadControllersFrom("controllers", application)

Alternatively, modify app/javascript/controllers/application.js as follows:

javascript
import { Application } from "@hotwired/stimulus"
const application = Application.start()

// Add the following two lines:
import HwComboboxController from "controllers/hw_combobox_controller"
application.register("hw-combobox", HwComboboxController)

export { application }

JS bundling (esbuild, rollup, etc)

First, install the JS portion of HotwireCombobox from npm with one of the following:

bash
yarn add @josefarias/hotwire_combobox
bash
npm install @josefarias/hotwire_combobox

Then, register the library's stimulus controller in app/javascript/controllers/application.js as follows:

javascript
import { Application } from "@hotwired/stimulus"
const application = Application.start()

// Add the following two lines:
import HwComboboxController from "@josefarias/hotwire_combobox"
application.register("hw-combobox", HwComboboxController)

export { application }

[!WARNING] Keep in mind you need to update both the npm package and the gem every time there's a new version of HotwireCombobox. You should always run the same version number on both sides.

Configuring CSS

This library comes with customizable default styles. Follow the instructions below to include them in your app.

Read the docs section for instructions on styling the combobox yourself.

Default

This approach works for all setups. Simply add the stylesheet to your layout (this would go in your document's ``):

erb

This helper accepts any of the options you can pass to stylesheet_link_tag.

Sprockets

Require the styles in app/assets/stylesheets/application.css:

erb
*= require hotwire_combobox

Docs

Visit the docs site for a demo and detailed documentation. If the site is down, you can run the docs locally by cloning the docs repo.

Notes about accessibility

This gem follows the APG combobox pattern guidelines with some exceptions we feel increase the usefulness of the component without much detriment to the overall accessible experience.

These are the exceptions:

  1. The listbox has wrap-around selection. That is, pressing Up Arrow when the user is on the first option will select the last option. And pressing Down Arrow when on the last option will select the first option. In paginated comboboxes, the first and last options refer to the currently available options. More options may be loaded after navigating to the last currently available option.
  2. It is possible to have an unlabeled combobox, as that responsibility is delegated to the implementing user.
  3. There are currently no APG guidelines for a multiselect combobox. We've introduced some mechanisms to make the experience accessible, like announcing multi-selections via a live region. But we'd welcome feedback on how to make it better until official guidelines are available.

It should be noted none of the maintainers use assistive technologies in their daily lives. If you do, and you feel these exceptions are detrimental to your ability to use the component, or if you find an undocumented exception, please open a GitHub issue. We'll get it sorted.

Contributing

Please read CONTRIBUTING.md.

License

The gem is available as open source under the terms of the MIT License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言