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 widget: Widget = DropDown {
selected: Some(view.state().sort_label.clone()),
on_toggle: Some(toggle_sort_panel_action),
options: vec!["Newest".into(), "Oldest".into()],
on_select: None,
}
.into();
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
| | | |
|---|
| | Action dispatched when the trigger is pressed. | Defaults to None. Usually opens or closes some surrounding surface. |
| | Option labels associated with the control. | Present in the struct, but not currently rendered by the widget itself. |
| | Selection action placeholder. | Present in the struct, but not currently used by the widget itself. |
| | 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.
Production checklist
For DropDown, review the fields that change behavior before treating the widget as finished: on_toggle, options, on_select, selected. The goal is to make the product rule visible in state and actions, not hidden inside ad-hoc construction code.
Bind on_toggle, on_select to explicit reducer actions and test that the reducer handles unavailable, duplicate, or invalid input safely.
Check the semantics tree for the user-facing label or role that makes this widget understandable without relying only on pixels.
Add at least one component or harness test that confirms the visible text, semantic role, action dispatch, and layout constraint that matter for this widget in context.
If a screen starts repeating the same DropDown setup, extract a named component around this widget. That keeps the reference API small while making product code easier to read and safer for generated code to copy.
Select, MenuButton, Button, and Combobox.