Dark Light
System
Default LBBW Jira Confluence Source Code
Share
Playground

Dropdown

<afp-dropdown> Since 1.0.0 stable This component uses the light DOM, so its markup and styles are part of the regular document flow.

A dropdown component that displays a list of actions or options when triggered.

Dropdown Dropdown Item Dropdown Item

Examples #

Keep Open #

Dropdowns can remain open after selecting an item by adding the keep attribute to the <afp-dropdown> component.

John Doe Profile Settings Notifications 23
Logout

Max Height #

You can set a maximum height for the dropdown using the --afp-dropdown-max-height CSS variable. If the content exceeds this height, a scrollbar will appear.

View Grid Source Canvas Preview Fullscreen
Preferences...

Min Width #

You can set a minimum width for the dropdown using the --afp-dropdown-min-width CSS variable.

Project

Collaboration

Share Invite members 2

Management

Archive Delete

Notes #

The Dropdown component is built on top of the Popover component and therefore inherits many of its configuration options.
This includes properties like placement, offset, strategy, and duration, which control how and where the dropdown appears, how far it’s positioned from its trigger, the positioning strategy (absolute or fixed), and the transition timing for showing or hiding it.

For a detailed explanation of these options, see the Popover documentation.

Properties

Learn more about properties.

Name Description Reflects
keep
Set to true to keep the dropdown open after selecting an item.
Type boolean
Default false
open
Indicates whether the dropdown is open.
Type boolean
Default false
strategy
Positioning strategy for the dropdown. Either `absolute` or `fixed`.
Type
AfpStrategy
Name Description
ABSOLUTE
Positioning using absolute positioning.
FIXED
Positioning using fixed positioning.
AfpStrategy
Default AfpStrategy.ABSOLUTE
offset
Offset configuration for positioning.
Type
AfpOffset
Name Description
mainAxis
type: number
crossAxis
type: number
alignmentAxis
type: number | null
AfpOffset
Default { mainAxis: 4, crossAxis: 0, alignmentAxis: 0, }
duration
Animation duration in milliseconds.
Type number
Default 150
placement
The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel inside of the viewport. If set to an empty array ([]), it enables auto placement. If containing more than two items, it is automatically restricted to the provided placements. You can also input a space-separated string.
Type
AfpPlacement
Name Description
TOP
Top placement.
RIGHT
Right placement.
BOTTOM
Bottom placement.
LEFT
Left placement.
TOP_START
Top-start placement.
TOP_END
Top-end placement.
RIGHT_START
Right-start placement.
RIGHT_END
Right-end placement.
BOTTOM_START
Bottom-start placement.
BOTTOM_END
Bottom-end placement.
LEFT_START
Left-start placement.
LEFT_END
Left-end placement.
AfpPlacement
Default [ AfpPlacement.BOTTOM_START, AfpPlacement.BOTTOM_END, AfpPlacement.TOP_START, AfpPlacement.TOP_END, ]

Methods

Learn more about using methods.

Name Description Arguments
show
Shows the dropdown.
-
hide
Hides the dropdown.
-
toggle
Toggles the dropdown open state.
-

Events

Learn more about events.

Name Return Description
afp-select string
Emitted when a dropdown item is selected.
afp-show void
Emitted when the dropdown is shown.
afp-after-show void
Emitted after the dropdown has been shown.
afp-hide void
Emitted when the dropdown is hidden.
afp-after-hide void
Emitted after the dropdown has been hidden.

Slots

Learn more about slots.

Name Description
default
The dropdown items (afp-dropdown-item).
trigger
The element that opens the dropdown.

CSS Parts

Learn more about CSS Parts.

Name Description Selector
base
The main wrapper element.
::part(base)

CSS Custom Properties

Name Description Default
--afp-dropdown-max-height
The maximum height of the dropdown panel.
15rem
--afp-dropdown-min-width
The minimum width of the dropdown panel.
auto

Dependencies

The component automatically brings in the listed items, including any nested dependencies that may exist.

afp-popover afp-dropdown-item

Importing

Using the bundle is the recommended method to include components. If you’d rather handle imports manually, you can use the code examples below.

import '@afp-design-system/core/dist/components/dropdown/dropdown.js';
Share
Create a link with a predefined theme that is automatically applied when the generated link is opened. Default LBBW Presentation Mode
Abort Copy Link