(props: SelectValueProps)
| 66 | /// The [`SelectValue`] component defines a span with a `data-placeholder` attribute if a placeholder is set. |
| 67 | #[component] |
| 68 | pub fn SelectValue(props: SelectValueProps) -> Element { |
| 69 | let ctx = use_context::<SelectContext>(); |
| 70 | |
| 71 | let is_empty = move || ctx.selectable.is_empty(); |
| 72 | let display_value = ctx |
| 73 | .selectable |
| 74 | .selected_text() |
| 75 | .unwrap_or_else(|| props.placeholder.cloned()); |
| 76 | |
| 77 | rsx! { |
| 78 | // Add placeholder option if needed |
| 79 | span { |
| 80 | "data-placeholder": is_empty(), |
| 81 | ..props.attributes, |
| 82 | {display_value} |
| 83 | } |
| 84 | } |
| 85 | } |
nothing calls this directly
no test coverage detected