Skip to content

[WEB-4682 | WEB-4685] feat: propel comobobox and command component #7615

Merged
sriramveeraghanta merged 7 commits intopreviewfrom
feat-propel-command-and-combobox-component
Aug 21, 2025
Merged

[WEB-4682 | WEB-4685] feat: propel comobobox and command component #7615
sriramveeraghanta merged 7 commits intopreviewfrom
feat-propel-command-and-combobox-component

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Aug 21, 2025

Description

This PR adds the Combobox and Command components to the Propel UI package.

Summary by CodeRabbit

  • New Features

    • Added a versatile Combobox (single/multi-select, optional search, selection limits, removable selections, accessible roles, disabled states, controlled/uncontrolled use).
    • Added a composite Command UI with Input, List, Empty, and Item subcomponents.
    • Made Command and Combobox available as public imports for easier integration.
  • Style

    • Consistent slot-based structure and class composition for flexible theming.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 21, 2025

Walkthrough

Adds two public exports ("./command" and "./combobox") to packages/propel and introduces new Command and Combobox React modules with barrel index files. Combobox is a compound component supporting controlled/uncontrolled usage and multi-select; no dependency changes.

Changes

Cohort / File(s) Summary
Package exports
packages/propel/package.json
Adds exports: ./command./src/command/index.ts, ./combobox./src/combobox/index.ts (existing ./popover unchanged).
Combobox module
packages/propel/src/combobox/*
New compound Combobox (combobox.tsx) with Button, Options, Option; supports controlled/uncontrolled value & open APIs, multiSelect + maxSelections, ComboboxContext for shared state, removal handling, ARIA attributes; barrel export via index.ts.
Command module
packages/propel/src/command/*
New composite Command (command.tsx) wrapping cmdk primitives with static subcomponents Input, List, Empty, Item; presentational wrappers using data-slot attributes; barrel export via index.ts.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Btn as Combobox.Button
  participant Pop as Popover
  participant Cmd as Command (Input/List)
  participant Ctx as ComboboxContext
  participant App as onValueChange

  User->>Btn: click (toggle)
  Btn->>Pop: toggle open
  Pop-->>User: show options

  User->>Cmd: type / navigate
  Cmd->>Cmd: filter options
  User->>Cmd: select item
  Cmd->>Ctx: handleValueChange(item)
  alt multiSelect
    Ctx->>Ctx: toggle selection (respect maxSelections)
    Ctx-->>App: onValueChange(newValues)
  else singleSelect
    Ctx->>Pop: close
    Ctx-->>App: onValueChange(newValue)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • sriramveeraghanta
  • vamsikrishnamathala

Poem

In a burrow of code I quietly nibble,
New Command and Combobox sprout at my nibble.
Popovers open, options hop in light,
Selections gather, choices feel right.
A rabbit applauds — small hops, big delight! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 69ed6f1 and 8a34ec5.

📒 Files selected for processing (1)
  • packages/propel/src/command/index.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/propel/src/command/index.ts
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-propel-command-and-combobox-component

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link

makeplane bot commented Aug 21, 2025

Pull Request Linked with Plane Work Items

References

Comment Automatically Generated by Plane

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (7)
packages/propel/src/command/command.tsx (3)

6-8: Nit: remove no-op cn("") usage.

cn("", className) is equivalent to cn(className).

-  return <CommandPrimitive data-slot="command" className={cn("", className)} {...props} />;
+  return <CommandPrimitive data-slot="command" className={cn(className)} {...props} />;

4-4: Consistency: align cn import with other modules.

Combobox imports cn from @plane/utils. Consider standardizing on a single source to avoid divergence.

-import { cn } from "@plane/ui";
+import { cn } from "@plane/utils";

10-20: Consider forwarding refs for better ergonomics.

Exposing refs on Command, Command.Input, and Command.Item improves focus management and integrability with forms.

Example for Command.Input:

const CommandInput = React.forwardRef<
  React.ElementRef<typeof CommandPrimitive.Input>,
  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
>(({ className, ...props }, ref) => (
  <div data-slot="command-input-wrapper" className="flex items-center gap-1.5 rounded border border-custom-border-100 bg-custom-background-90 px-2">
    <SearchIcon className="size-3.5 flex-shrink-0 text-custom-text-400" strokeWidth={1.5} />
    <CommandPrimitive.Input ref={ref} data-slot="command-input" className={cn(className)} {...props} />
  </div>
));
packages/propel/src/combobox/combobox.tsx (4)

284-287: Minor: keep explicit type parity with cmdk.

No behavior change; ensures onSelect receives a string and keeps props tidy after the type change.

-  return (
-    <Command.Item value={stringValue} disabled={isDisabled} onSelect={handleValueChange} className={className}>
-      {children}
-    </Command.Item>
-  );
+  return (
+    <Command.Item
+      value={stringValue}
+      disabled={isDisabled}
+      onSelect={handleValueChange}
+      className={className}
+    >
+      {children}
+    </Command.Item>
+  );

6-12: Dead API surface: exported ComboboxOption interface is unused.

ComboboxOption (with query, content, tooltip) isn’t referenced by the components. Either wire it into the API (e.g., accept an options: ComboboxOption[]) or drop the export to avoid confusion.


32-42: Unused prop: showCheckIcon is defined but never used.

If keeping it, render a checkmark for selected items in ComboboxOption when multiSelect is true.

I can draft a minimal implementation that conditionally shows a check icon without imposing styling, if you want to include it in this PR.


2-4: Create a barrel for Command to enable consistent imports

The packages/propel/src/command directory currently lacks an index.ts barrel, so importing via import { Command } from "../command"; would fail. To align with your existing Popover barrel and keep imports resilient to future file renames, consider:

  • Adding a barrel file at
    packages/propel/src/command/index.ts with:
    export * from "./command";
  • Updating your imports in combobox.tsx accordingly:
    - import { Command } from "../command/command";
    + import { Command } from "../command";
    - import { Popover } from "../popover/root";
    + import { Popover } from "../popover";

The Popover barrel already exists (packages/propel/src/popover/index.ts exports from ./root), so no extra setup is needed there.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 03479cf and 1d05e18.

📒 Files selected for processing (4)
  • packages/propel/package.json (1 hunks)
  • packages/propel/src/combobox/combobox.tsx (1 hunks)
  • packages/propel/src/combobox/index.ts (1 hunks)
  • packages/propel/src/command/command.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
packages/propel/src/combobox/index.ts (1)

1-1: Barrel export looks good.

Keeps the public surface simple and tree-shakeable.

packages/propel/src/combobox/combobox.tsx (2)

39-40: Naming: confirm maxHeight token "rg".

"rg" is unconventional next to "lg | md | sm". If intentional ("regular"), OK; otherwise consider aligning with a standard scale (e.g., "xl | lg | md | sm").


231-263: A11y: ensure Popover.Panel semantics match listbox expectations.

You’ve set role="listbox" and aria-multiselectable on Command.List, which is good. Double-check that Popover.Panel doesn’t add conflicting roles and that focus is correctly moved to the list or first item when opened (Radix-style APIs sometimes require aria-controls/focus management).

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/propel/src/combobox/combobox.tsx (1)

270-275: Remove the redundant alias and clean up memo deps.

const stringValue = value; adds noise and leaks into dependency arrays. Use value directly in comparisons and props.

Apply:

-  const stringValue = value;
   const isSelected = React.useMemo(() => {
     if (!multiSelect) return false;
-    return Array.isArray(selectedValue) ? (selectedValue as string[]).includes(stringValue) : false;
-  }, [multiSelect, selectedValue, stringValue]);
+    return Array.isArray(selectedValue) ? (selectedValue as string[]).includes(value) : false;
+  }, [multiSelect, selectedValue, value]);

-  return (
-    <Command.Item value={stringValue} disabled={isDisabled} onSelect={handleValueChange} className={className}>
+  return (
+    <Command.Item value={value} disabled={isDisabled} onSelect={handleValueChange} className={className}>
       {children}
     </Command.Item>
   );
🧹 Nitpick comments (5)
packages/propel/src/combobox/combobox.tsx (5)

6-12: Unify option value typing with the string-based API.

ComboboxOption.value is unknown, while the rest of the component surface is string-only (ComboboxProps.value: string | string[], ComboboxOptionProps.value: string). Keeping this as unknown invites lossy coercion and identity collisions downstream. Align this to string (or remove the unused interface if it isn’t part of the public API yet).

Apply:

 export interface ComboboxOption {
-  value: unknown;
+  value: string;
   query: string;
   content: React.ReactNode;
   disabled?: boolean;
   tooltip?: string | React.ReactNode;
 }

32-42: Implement showCheckIcon (currently unused) via a lightweight Options context.

ComboboxOptionsProps.showCheckIcon is declared but never read; consumers can’t actually toggle selection indicators. Recommend threading this value via a local context provided by ComboboxOptions and consumed by ComboboxOption, rendering a checkmark for the selected item(s).

Diffs within the shown ranges:

 function ComboboxOptions({
   children,
   showSearch = false,
   searchPlaceholder,
   maxHeight,
   className,
   inputClassName,
   optionsContainerClassName,
-  emptyMessage,
+  emptyMessage,
+  showCheckIcon,
 }: ComboboxOptionsProps) {
   const { multiSelect } = useComboboxContext();
   return (
-    <Popover.Panel sideOffset={8} className={cn(className)}>
+    <OptionsSettingsContext.Provider value={{ showCheckIcon }}>
+      <Popover.Panel sideOffset={8} className={cn(className)}>
         <Command>
           {showSearch && <Command.Input placeholder={searchPlaceholder} className={cn(inputClassName)} />}
           <Command.List
             className={cn(
               {
                 "max-h-60": maxHeight === "lg",
                 "max-h-48": maxHeight === "md",
                 "max-h-36": maxHeight === "rg",
                 "max-h-28": maxHeight === "sm",
               },
               optionsContainerClassName
             )}
             role="listbox"
             aria-multiselectable={multiSelect || undefined}
           >
             {children}
           </Command.List>
           <Command.Empty>{emptyMessage ?? "No options found."}</Command.Empty>
         </Command>
-    </Popover.Panel>
+      </Popover.Panel>
+    </OptionsSettingsContext.Provider>
   );
 }

And within ComboboxOption (context consumption + indicator, see separate diff in the comment below for the surrounding lines), add:

+  const { showCheckIcon } = React.useContext(OptionsSettingsContext);
+  const singleSelected =
+    !multiSelect && !Array.isArray(selectedValue) && selectedValue === value;
+  const showIndicator = !!showCheckIcon && (multiSelect ? isSelected : singleSelected);

Then render an indicator:

   return (
-    <Command.Item value={value} disabled={isDisabled} onSelect={handleValueChange} className={className}>
-      {children}
-    </Command.Item>
+    <Command.Item value={value} disabled={isDisabled} onSelect={handleValueChange} className={className}>
+      {showIndicator && <span aria-hidden="true" className="mr-2">✓</span>}
+      {children}
+    </Command.Item>
   );

Outside of the shown ranges (add once near other context declarations):

// Add near ComboboxContext
const OptionsSettingsContext = React.createContext<{ showCheckIcon?: boolean }>({});

Also applies to: 231-265


215-229: A11y: Consider linking button and listbox via aria-controls/id.

Optional but recommended for the button+listbox pattern: give the listbox an id and reference it from the trigger with aria-controls. Since Button and Options are siblings, the simplest approach is to generate an id in the root and share via context.

Sketch:

 interface ComboboxContextType {
   value: string | string[];
   onValueChange?: (value: string | string[]) => void;
   multiSelect: boolean;
   maxSelections?: number;
   disabled: boolean;
   open: boolean;
   setOpen: (open: boolean) => void;
   handleValueChange: (newValue: string) => void;
   handleRemoveSelection: (valueToRemove: string) => void;
+  listboxId: string;
 }
 function ComboboxComponent({...}: ComboboxProps) {
+  const listboxId = React.useId();
   ...
   const contextValue = React.useMemo<ComboboxContextType>(
     () => ({
       value: internalValue,
       onValueChange,
       multiSelect,
       maxSelections,
       disabled,
       open,
       setOpen,
       handleValueChange,
       handleRemoveSelection,
+      listboxId,
     }),
     [/* existing deps */, /* + */ listboxId]
   );
 function ComboboxButton({...}) {
-  const { disabled: ctxDisabled, open } = useComboboxContext();
+  const { disabled: ctxDisabled, open, listboxId } = useComboboxContext();
   ...
   <Popover.Button
     ...
-    aria-expanded={open}
+    aria-expanded={open}
+    aria-controls={listboxId}
   >
 <Command.List
   ...
+  id={listboxId}
   role="listbox"
   aria-multiselectable={multiSelect || undefined}
>

Also applies to: 246-257


39-41: Nit: size token “rg”.

The size alias rg is uncommon alongside sm | md | lg. If this is meant to be “regular,” consider using base/md or adding xl | lg | md | sm for consistency with existing components. Otherwise, document rg in the props JSDoc.

Would you like me to align this with an existing design token set in the codebase if there is one?

Also applies to: 249-253


85-90: Clarify multiSelect contract or normalize state shape

A search across all .tsx files found no instances where <Combobox multiSelect={…}> is toggled dynamically at runtime. While this makes breakage unlikely in the current codebase, it’s still best to explicitly document the expected stability of the multiSelect prop and optionally safeguard uncontrolled usage against late flips:

• Document that the multiSelect prop is static for the component’s lifetime.
• (optional) Add an effect to normalize the internal state shape when multiSelect changes in uncontrolled mode:

   // Update internal value when prop changes
   React.useEffect(() => {
     if (isControlledValue) {
       setInternalValue(value as string | string[]);
     }
   }, [isControlledValue, value]);

+  // Normalize value shape if multiSelect flips during lifetime (uncontrolled only)
+  React.useEffect(() => {
+    if (isControlledValue) return;
+    setInternalValue((prev) => {
+      // single -> multi
+      if (multiSelect && !Array.isArray(prev)) {
+        const next = prev ? [prev as string] : [];
+        onValueChange?.(next);
+        return next;
+      }
+      // multi -> single
+      if (!multiSelect && Array.isArray(prev)) {
+        const [first = ""] = prev as string[];
+        onValueChange?.(first);
+        return first;
+      }
+      return prev;
+    });
+  }, [multiSelect, isControlledValue, onValueChange]);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 205bc40 and ecc5d2c.

📒 Files selected for processing (1)
  • packages/propel/src/combobox/combobox.tsx (1 hunks)
🔇 Additional comments (1)
packages/propel/src/combobox/combobox.tsx (1)

239-262: LGTM: emptyMessage is now respected.

<Command.Empty> now renders emptyMessage ?? "No options found.", enabling customization without breaking defaults.

…om:makeplane/plane into feat-propel-command-and-combobox-component
@sriramveeraghanta sriramveeraghanta merged commit e86b40a into preview Aug 21, 2025
6 of 7 checks passed
@sriramveeraghanta sriramveeraghanta deleted the feat-propel-command-and-combobox-component branch August 21, 2025 10:02
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