DropdownComponent

open class DropdownComponent : Component<Unit>

This class combines the configuration and rendering of a dropdown.

A dropdown consists of a toggle element as well as it's actual content in form of any fritz2-component. The toggle property can be used to specify a non-default toggle and the content property is used to specify the dropdown's content. A button with a standard menu-icon is used if no other toggle-element is specified.

The dropdown floats around the toggle-element and can be closed by simply clicking outside the dropdown. The opening an closing behavior can manually be controlled as well by specifying the visible property. It takes a flow of values to determine whether the dropdown should be visible or not.

The dropdown can be placed to the left, to the right, on top of, or below the toggle-element. Additionally it can either be aligned to the start or end of the placement's cross-axis. This can be specified via the respective placement and alignment properties. The default positioning is bottom start.

Example usage:

dropdown {
toggle {
// some layout
}
placement { bottom }
alignment { start }
content {
// some layout
}
}

Constructors

DropdownComponent
Link copied to clipboard
js
fun DropdownComponent()

Types

Alignment
Link copied to clipboard
js
enum Alignment : Enum<DropdownComponent.Alignment>
AlignmentContext
Link copied to clipboard
js
object AlignmentContext
Placement
Link copied to clipboard
js
enum Placement : Enum<DropdownComponent.Placement>
PlacementContext
Link copied to clipboard
js
object PlacementContext

Functions

render
Link copied to clipboard
js
open override fun render(context: RenderContext, styling: BoxParams.() -> Unit, baseClass: StyleClass, id: String?, prefix: String)
Central method that should do the actual rendering of a component.

Properties

alignment
Link copied to clipboard
content
Link copied to clipboard
js
val content: ComponentProperty<RenderContext.() -> Unit>
placement
Link copied to clipboard
toggle
Link copied to clipboard
js
val toggle: ComponentProperty<RenderContext.() -> Unit>