Skip to content

How to reset second Select when choosing item from first Select? #1105

Discussion options

You must be logged in to vote

Hey, @MattHeslington

Got it working with a weird hack 😅

I created a reactive object variable:

	$: selectedSubCategory = {
		label: subCategory,
		value: subCategory
	};

And assigned it to the selected prop of the second select component.

<Select.Root
		selected={selectedSubCategory}
		onSelectedChange={(v) => {
			subCategory = v?.label;
		}}
	>

Now, any changes to the first select will reset the second one. 🤷‍♂️

Screen.Recording.2024-05-22.at.12.16.23.mov

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@shyakadavis
Comment options

Answer selected by MattHeslington
@MattHeslington
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants