Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a onHighlight prop to Command.Item #95

Open
CNSeniorious000 opened this issue Aug 4, 2024 · 1 comment
Open

Add a onHighlight prop to Command.Item #95

CNSeniorious000 opened this issue Aug 4, 2024 · 1 comment

Comments

@CNSeniorious000
Copy link

I want to run some callback (like preloding) for command items.
For now I can only do this with an ugly hack like this:

  <Command.Item asChild let:action let:attrs>
    <!-- eslint-disable-next-line no-unused-vars -->
    {@const _ = (browser && attrs["data-selected"] && preloadData(item.href))}
    <a href={item.href} use:action {...attrs} class:selected={attrs["data-selected"]}>
      {item.text}
    </a>
  </Command.Item>

Previously discussed in sveltejs/svelte#12726

@ArturLinnik
Copy link

Yes I was struggling with this too. I have a search bar with coordinates that are shown in a map. I want to change the map dynamically while navigating the items list. It would be nice if that prop is added.

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

No branches or pull requests

2 participants