Skip to main content

DropDown

DropDown is a simplified dropdown-style trigger button.

It looks like a dropdown control, showing the current selection and a chevron, but the checked-in implementation is intentionally small: it only renders the trigger. It does not render the list of options for you. If you need a complete selection control, use Select.

Example

use fission::prelude::*;

let node = DropDown {
selected: Some(view.state.sort_label.clone()),
on_toggle: Some(toggle_sort_panel_action),
options: vec!["Newest".into(), "Oldest".into()],
on_select: None,
}
.build(ctx, view);

This is a good fit when some other part of your user interface owns the actual popup or sheet, and you only want a trigger with dropdown styling.

Field table

FieldTypeMeaningNotes / default behavior
on_toggleOption<ActionEnvelope>Action dispatched when the trigger is pressed.Defaults to None. Usually opens or closes some surrounding surface.
optionsVec<String>Option labels associated with the control.Present in the struct, but not currently rendered by the widget itself.
on_selectOption<ActionEnvelope>Selection action placeholder.Present in the struct, but not currently used by the widget itself.
selectedOption<String>Currently displayed label.If None, the trigger shows "Select an option".

Current behavior

In the checked-in implementation, selected changes the label and on_toggle drives the press behavior. options and on_select do not affect rendering yet. That makes DropDown best understood as a stylized trigger, not a finished dropdown system.

Specific advice

Reach for DropDown only when that limitation is exactly what you want. If the user expects the widget itself to own option presentation and choice handling, use Select or MenuButton instead.

Select, MenuButton, Button, and Combobox.