pub struct DropdownItemProps {
pub active: bool,
pub disabled: bool,
pub href: Option<String>,
pub target: Option<String>,
pub onclick: Option<EventHandler<MouseEvent>>,
pub tag: String,
pub class: String,
pub children: Element,
/* private fields */
}Expand description
A single item in a Dropdown menu.
Renders a <button class="dropdown-item"> by default. Set href to render a
real <a class="dropdown-item" href=...> instead — use this for menu entries
that navigate to a URL so the browser’s link behaviours work (middle-click /
ctrl-click to open in a background tab, copy-link and open-in-new-window
context actions, and a visible target URL on hover). Add target (e.g.
"_blank") to open in a new tab. The same active, disabled, class, and
onclick props apply to both forms.
rsx! {
DropdownItem { "Action" } // <button>
DropdownItem { href: "/settings", "Settings" } // <a href="/settings">
DropdownItem { href: "https://example.com", target: "_blank", "Docs" }
}Fields§
§active: boolActive state.
disabled: boolDisabled state.
href: Option<String>When set, render an <a class="dropdown-item" href=...> anchor instead of
a <button> so the item behaves as a real hyperlink. Anchors cannot be
HTML-disabled, so a disabled anchor item carries the .disabled class,
aria-disabled="true", and tabindex="-1" (matching NavLink).
target: Option<String>Anchor target (e.g. "_blank" to open in a new tab). Only applies when
href is set.
onclick: Option<EventHandler<MouseEvent>>Click event handler.
tag: StringItem wrapper. Empty (the default) wraps the item in the <li> a <ul>
menu requires; "div" emits the bare <button>/<a> for the generic
DropdownMenu { tag: "div" } form, where an <li> would have no list to
belong to. Match it to the menu’s tag.
class: StringAdditional CSS classes.
children: ElementChild elements.
Implementations§
Source§impl DropdownItemProps
impl DropdownItemProps
Sourcepub fn builder() -> DropdownItemPropsBuilder<((), (), (), (), (), (), (), (), ())>
pub fn builder() -> DropdownItemPropsBuilder<((), (), (), (), (), (), (), (), ())>
Create a builder for building DropdownItemProps.
On the builder, call .active(...)(optional), .disabled(...)(optional), .href(...)(optional), .target(...)(optional), .onclick(...)(optional), .tag(...)(optional), .class(...)(optional), .attributes(...)(optional), .children(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of DropdownItemProps.
Trait Implementations§
Source§impl Clone for DropdownItemProps
impl Clone for DropdownItemProps
Source§fn clone(&self) -> DropdownItemProps
fn clone(&self) -> DropdownItemProps
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more