top of page

Dropdown list on Wix

Jan 15, 2022
3 min read

Updated: 18 hours ago

Today we’re going to look at how to create a dropdown list on Wix using code. This feature is especially useful for websites with a large amount of information. A page with collapsible subitems always looks more organized and visually balanced.

View Example >

Dropdown List on Wix

What changed in 2026

Wix has moved site coding from Velo to a unified JavaScript SDK. According to the Wix developer docs, you can now use the SDK for most functionality, and Wix offers a migration guide from Velo. Existing Velo code keeps working, so the example below still runs, but new projects are better started with the SDK.

  • Where to code: the built-in Code panel in Wix Studio or the Wix Editor, the Wix IDE (a VS Code-based online editor for Wix Studio sites) or your own IDE connected through GitHub and the Wix CLI.

  • Wix Harmony doesn't support site code. Wix says that Harmony, its newest editor, doesn't support site code; you can only add HTML, JavaScript and CSS snippets as custom code. For tutorials like this one, use Wix Studio or the Wix Editor.

  • AI help: the Wix IDE includes an AI assistant for code, which is handy for adapting this example to your own elements.

Example description of the dropdown list

This example shows how to integrate a collapsible list into your website. Elements on the page open menu sections when the user clicks one of the arrows. The items of each menu section are placed inside a box.

Note that opening or closing the box affects all the elements inside it, so we don’t need to expand or collapse each item individually.

How to set up the elements on the page

  1. Add 4 header boxes to the page and give them the IDs headerBox1–headerBox4.

  2. Under each header, place a box with the section content and give it the ID fold1–fold4. In its properties, tick Collapsed on load.

  3. Add two arrows to each header: a down arrow with the ID arrowDown1–4 (hidden on load) and a right arrow with the ID arrowRight1–4.

  4. Turn on Dev Mode (Wix Editor) or open the code panel (Wix Studio) and paste the code below into the page code.

  5. For each headerBox, add an onClick event in the properties panel — the headerBox1_onClick functions are already in the code.

Code for the dropdown list

Copy the code to create your own list.

function toggleFold(index) {
	let $fold = $w('#fold' + index);
	let $arrowDown = $w('#arrowDown' + index);
	let $arrowRight = $w('#arrowRight' + index);
	// toggle the fold at the index
	if ($fold.collapsed) {
		$fold.expand();
		$arrowDown.show();
		$arrowRight.hide();
	} else {
		$fold.collapse();
		$arrowDown.hide();
		$arrowRight.show();
	}
	// collapse the other folds
	[1, 2, 3, 4]
	.filter(idx => idx !== index)
		.forEach(idx => {
			$w('#fold' + idx).collapse();
			$w('#arrowDown' + idx).hide();
			$w('#arrowRight' + idx).show();
		})
}
export function headerBox1_onClick(event) {
	toggleFold(1);
}
export function headerBox2_onClick(event) {
	toggleFold(2);
}
export function headerBox3_onClick(event) {
	toggleFold(3);
}
export function headerBox4_onClick(event) {
	toggleFold(4);
}

Video tutorial on creating a dropdown list on Wix

How the code works

When a header is clicked, the toggleFold function expands that section, shows the down arrow and collapses all the other sections at the same time. Only one item stays open, so the page never turns into one long wall of text.

Can you do it without code?

Yes. For a simple accordion with questions and answers, use ready-made elements: collapsible text in the Wix Editor, or FAQ blocks and accordions in Wix Studio and the Wix FAQ app. Velo code makes sense when sections need images, buttons and complex layouts.

Julia's tip, SEO MAMA: don't hide the essentials in collapsed sections — prices, terms and the answers people came for. Collapsed text is indexed, but visitors may never open it. Collapse the details and keep the key points visible.

Wix dropdown FAQ

How do I add a dropdown in Wix?

In the editor, click Add → Input → Dropdown, then set the options in the element's settings.

Yes, with Velo: load options from a CMS collection so you don't have to update them by hand.

With Velo: when a value is chosen in the first dropdown, code filters the options in the second one.

Yes, on phones they open the native picker, but long lists are better replaced with search or buttons.

SEO MAMA is an official Wix Legend partner. We build and optimize Wix sites, from editor setup to SEO. Learn more: Wix SEO services.

Julia_edited_edited.jpg

Have a question?

Contact us

Contact us

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Recent posts

Speak AI Review: AI Transcription and Translation for Audio and Video

Speak AI Review: AI Transcription and Translation for Audio and Video

29 Nov 2026

Sales Funnel for a Service Website: Stages, Examples and Setup

Sales Funnel for a Service Website: Stages, Examples and Setup

29 Nov 2026

How Artificial Intelligence Works: A Simple Explanation for Business

How Artificial Intelligence Works: A Simple Explanation for Business

29 Nov 2026

The Best AI Content Generators in 2026: Review and Comparison

The Best AI Content Generators in 2026: Review and Comparison

29 Nov 2026

bottom of page