pub struct TagBox { /* private fields */ }Expand description
Picks several values from a list, showing each as a tag with a button to take it off. The list searches as you type; Enter picks or takes off the highlighted option, Backspace on the empty search takes off the last tag, Escape closes.
use ravenrs_reactive::State;
use ravenrs_widgets::{LookupItem, TagBox, Ui};
let tags = State::new(vec!["red".to_owned()]);
let field = TagBox::new(
tags.binding(),
vec![LookupItem::new("red", "Red"), LookupItem::new("blue", "Blue")],
);
let mut ui = Ui::new(field, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl TagBox
impl TagBox
Sourcepub fn new(selected: Binding<Vec<String>>, options: Vec<LookupItem>) -> Self
pub fn new(selected: Binding<Vec<String>>, options: Vec<LookupItem>) -> Self
A field bound to the keys chosen, in the order they were chosen.
Sourcepub fn placeholder(self, text: impl Into<String>) -> Self
pub fn placeholder(self, text: impl Into<String>) -> Self
Text shown while nothing is chosen.
Sourcepub fn allow_new(self, allow: bool) -> Self
pub fn allow_new(self, allow: bool) -> Self
Lets people add what they typed when it is not in the list. The text becomes the key.
Sourcepub fn width(self, width: f32) -> Self
pub fn width(self, width: f32) -> Self
Width in logical pixels. 280 by default; tags that do not fit go to a new line.
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
The name screen readers announce. Inside a crate::FormField, its label is used instead.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TagBox
impl !Send for TagBox
impl !Sync for TagBox
impl !UnwindSafe for TagBox
impl Freeze for TagBox
impl Unpin for TagBox
impl UnsafeUnpin for TagBox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Adds padding inside the box, in logical pixels.
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Paints a background behind the content.
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
Fixes the width and/or height in logical pixels;
None keeps the content size.