Create his own custom dropdown #4650
-
|
Hi, #[derive(Clone, Debug, PartialEq, Eq)]
pub struct SelectOption<T> {
pub value: T,
pub label: String,
}The String label doesn’t allow me to use, for example, an SVG instead of text for my dropdown button or its options. I’d like to be able to customize the display of the options and the button. Also, currently my button displays the selected option. I’d like, for example, for my option to have a corresponding SVG and for that SVG to be displayed in the button. This would allow me to have longer options, but in the button, the selected option would be displayed in a shortened format to take up less space in a toolbar or filter bar. So I was thinking of replacing the String label with View controls and using two of them (one for the button and one for the option). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Sure. The best provided helper for this is probably |
Beta Was this translation helpful? Give feedback.
Sure. The best provided helper for this is probably
ViewFn, which is the same type that's used for fallbacks forSuspenseandShowand so on.