Dropdown

Displays a popup around an anchor component.

$ import { Dropdown } from 'geist-ui-svelte';

Basic

This is a dropdown
NOTE: Be careful when working with containers that use `position: relative;` as it can mess with the placement.

Placement

The dropdown has different placement options that can be used to adjust the positioning of the dropdown. Notice how the dropdown also animates based on the placement. This is made possible through our custom placement functions. The default placement is `bottom-start`.

AB
Aidan Bleser @ieedan


Dashboard Settings


Homepage


Shadow

Add a shadow to the drop down.

This is a dropdown

Overflow

Even though we implemented our own functions for placement notice how the dropdown still reacts to overflow Try scrolling the page with the dropdown open and see the results.

This is a dropdown

Anchor Binding

You can bind a reference to an anchor or a query selector. This can be useful when working with something like context menus on dynamic list where you can't create a reference for each item in the list.

This is a dropdown
1
2
3
+
4
5
6
7
8

Anchor Events

Sometimes it may be necessary or more convenient to create the event listener from the Dropdown itself for this you can use the `event` attribute.

This is a dropdown
This is a dropdown
This is a dropdown
1
2
3
4
+
5
6
7
8
9
10
11
12
+
13
14
15
16
17
18
19
20
+
21
22
23
24

Animation

Because dropdown keeps track of the position the drop down ends up at it can animate the in and out. You can disable this using the `animate` attribute.

This is a dropdown
1
2
3
4
5
6
+
7
8

Offsets

You can use offsets to add space between the anchor and the dropdown.

This is a dropdown
1
2
3
4
5
6
7
8
9
+
10
11

Scroll Lock

Sometimes you may want to lock scroll when a popup is open add the `lockScroll` attribute to hide the scrollbar when visible.

NOTE: Remember to use `scrollbar-gutter: stable;` to prevent layout shift when using this feature.
This is a dropdown
1
2
3
4
5
6
7
8
+
9
10


Last Page