Skip to content

Dropdown

The dropdown component is a simple wrapper around a button and a list of items. It is used to create a dropdown menu, that can be opened and closed by clicking on the button or clicking outside the dropdown.

Usage

vue
<script setup lang="ts">
import { Dropdown, DropdownItem, DropdownDivider } from "@froeschke/ui";
</script>

<template>
  <Dropdown title="Dropdown" direction="left">
    <DropdownItem href="/item-1">Item 1</DropdownItem>
    <DropdownItem href="/item-2">Item 2</DropdownItem>
    <DropdownDivider />
    <DropdownItem href="/item-3">Item 3</DropdownItem>
  </Dropdown>
</template>

Props

NameTypeDefaultDescription
titleString-The title of the dropdown button
directionString: left or rightrightThe direction in which the dropdown should open
NameTypeDefaultDescription
toObject or String-The route to navigate to (Vue Router)
hrefString-The URL to navigate to
targetString_selfThe target of the link

Events

NameDescription
click-outsideEmitted when the dropdown is closed