Skip to main content

lumen_dioxus/inputs/
input_group.rs

1//! `InputGroup`: an input with inline text or icons inside one bordered control.
2
3use dioxus::prelude::*;
4
5use crate::class::compose;
6
7/// Props for [`InputGroup`].
8#[derive(Props, Clone, PartialEq)]
9pub struct InputGroupProps {
10    /// Extra classes appended after the Lumen class.
11    #[props(into)]
12    pub class: Option<String>,
13    /// Any other `<div>` or global attribute.
14    #[props(extends = GlobalAttributes, extends = div)]
15    pub attributes: Vec<Attribute>,
16    /// The control plus leading or trailing text (`span`, `strong`), icons, or buttons.
17    pub children: Element,
18}
19
20/// Wraps an input with inline prefixes or suffixes, such as a currency sign, a unit, or an icon,
21/// inside one bordered control.
22#[component]
23pub fn InputGroup(props: InputGroupProps) -> Element {
24    let class = compose([Some("ui-input-group"), props.class.as_deref()]);
25
26    rsx! {
27        div { class, ..props.attributes, {props.children} }
28    }
29}