Skip to content

ListSorting

View source on GitHub

Dropdown component for selecting a sorting option for a list. Displays the current sorting and emits the selected value. *

Props

NameTypeRequiredDescription
optionsstring[]yesArray of sorting options.
sortingstringyesThe currently selected sorting option.

Emits

  • choose:sorting

Exposed Methods

toggleList()

Toggles the visibility of the sorting options dropdown.

selectOption()

Selects a sorting option, emits the event, and closes the dropdown.

Parameters:

  • option (string): The selected sorting option.

handleClickOutside()

Handles clicks outside the dropdown to close it.

Parameters:

  • event (MouseEvent): The click event.