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>) -> TagBox
pub fn new(selected: Binding<Vec<String>>, options: Vec<LookupItem>) -> TagBox
A field bound to the keys chosen, in the order they were chosen.
Sourcepub fn placeholder(self, text: impl Into<String>) -> TagBox
pub fn placeholder(self, text: impl Into<String>) -> TagBox
Text shown while nothing is chosen.
Sourcepub fn allow_new(self, allow: bool) -> TagBox
pub fn allow_new(self, allow: bool) -> TagBox
Lets people add what they typed when it is not in the list. The text becomes the key.
Sourcepub fn width(self, width: f32) -> TagBox
pub fn width(self, width: f32) -> TagBox
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>) -> TagBox
pub fn label(self, label: impl Into<String>) -> TagBox
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§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
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.