Skip to content

combobox: Add Combobox and MultiCombobox components#2373

Closed
huacnlee wants to merge 12 commits into
mainfrom
combo-box
Closed

combobox: Add Combobox and MultiCombobox components#2373
huacnlee wants to merge 12 commits into
mainfrom
combo-box

Conversation

@huacnlee

Copy link
Copy Markdown
Member

Summary

  • Extract searchable_list module shared by Select, Combobox
  • Add Combobox component with single/multi-select support, inspired by Shadcn Combobox API:
    • multiple(bool) prop instead of a ComboBoxMode enum — aligns with Shadcn's multiple attribute
    • Single-select closes the popover on selection; multi-select stays open — no close_on_select needed
    • render_trigger closure for fully custom trigger rendering
    • footer slot for bottom-of-popup actions
    • check_icon override for selected-item indicator
    • searchable(bool) for in-popup search filtering
  • Module and type naming follows Shadcn convention: combobox / Combobox (not combo_box / ComboBox)
  • Add ComboboxStory gallery with demo sections covering single, multi, grouped, custom trigger, footer, chip badges, and delegate hooks

Test plan

  • Run story gallery (cargo run) and verify Combobox panel renders correctly
  • Single-select: selecting an item closes the popup and updates the trigger label
  • Multi-select (.multiple(true)): selecting items toggles them, popup stays open, trigger shows comma-separated titles
  • Search filtering works in both modes
  • Custom render_trigger renders correctly
  • Footer slot appears below the list with a separator
  • Cleanable (×) button clears selection
  • Keyboard navigation (↑↓ Enter Escape) works as expected

🤖 Generated with Claude Code

regexident and others added 12 commits May 12, 2026 21:11
…lect

- Rename module `combo_box` → `combobox` and all types
  (`ComboBox`→`Combobox`, `ComboBoxState`→`ComboboxState`, etc.)
- Replace `ComboBoxMode::Single/Multi` enum with a `multiple(bool)` prop,
  matching Shadcn Combobox API (`multiple` attribute)
- Remove `close_on_select`: behavior is now derived from `multiple`
  (single→close on select, multiple→stay open), matching Shadcn semantics

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…inks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…or unified multiple(bool)

- Add Select vs Combobox feature comparison table
- Highlight multi-select as the key differentiator from Select
- Fix import section: remove deprecated MultiComboBox/MultiComboBoxState types
- Fix all code examples to use current API (ComboboxState, multiple(true), vec![] indices)
- Fix ComboboxTriggerCtx usage: ctx.selection instead of ctx.selected_item
- Merge single/multi-select sections into unified usage examples

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename trigger_icon() → icon() to match Select's convention
- Add selected_value() → Option<Value> convenience for single-select
- Add window param to set_selected_indices() to match set_selected_index() in Select
- Restrict handle_item_select to pub(crate) — internal/test use only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ger closures

Callers no longer need .into_any_element() — the conversion happens inside
the builder method.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
"El" abbreviation is not allowed by project convention.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dule

- Rename `ComboboxTriggerCtx` → `ComboboxTriggerContext` (no abbreviations)
- Make `searchable_list` module `pub(crate)`; re-export needed types from
  `combobox` so users can import via `combobox::*` without touching the
  internal module
- Remove dead `is_open` / `focus_handle` methods from `SearchableListState`
  (became unreachable after visibility change)
- Update `combobox_story.rs` to drop direct `searchable_list` import
- Sync docs (EN + zh-CN): fix import block and `ComboboxTriggerContext` refs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rror

The bnjbvr/cargo-machete@v0.9.1 action uses clechasseur/rs-cargo@v3
internally which invokes `cargo +stable install`, causing a failure in
the CI environment that doesn't support the toolchain override syntax.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@huacnlee huacnlee closed this May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants