pacocoursey / cmdk

Fast, unstyled command menu React component.
https://cmdk.paco.me
MIT License
9.04k stars 259 forks source link

forceMount is not defined #164

Closed nickscamara closed 5 months ago

nickscamara commented 11 months ago

Hi there,

I am trying to set forceMount prop on my Command.Item but it says that the prop doesn't exist.

Would love to know if I am doing something wrong?

Thanks in advance for the help. For reference, here is the snippet I am trying to use:

const CommandItem = React.forwardRef<
  React.ElementRef<typeof CommandPrimitive.Item>,
  React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
>(({ className, ...props }, ref) => (
  <CommandItem
    ref={ref}
    forceMount 
    className={cn(
      "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
      className
    )}
    {...props}
  />
))
nickscamara commented 11 months ago

After taking a better look, seems like forceMount was recently introduced, but not released in a version.

tywenk commented 8 months ago

+1. I too was looking for the forceMount prop as it was mentioned multiple times in the docs. It's release would be greatly appreciated. Without it I have to set shouldFilter={false} and control state manually just to render items that I want to hard code at the top of lists (like a "Create new value" item).

charislam commented 7 months ago

+1 for a release that includes forceMount. It's an incredibly useful feature that requires some hacky workarounds to reproduce if not available

rrichc commented 7 months ago

Ditto for another release, I currently have the package's main branch manually imported into my project to make use of forceMount

ulugmer commented 6 months ago

+1

pacocoursey commented 5 months ago

Released.

nickscamara commented 5 months ago

Awesome! Thank you! @pacocoursey