Available on crate feature
chip only.Expand description
Compact pills for chosen values, such as guests or tags, with an optional x button that removes them.
Chips share the badge colours and are
Variant::Secondary by default. Give a chip Chip::on_remove to
draw the x, and Chip::id to find that x in tests through
remove_id.
use iced::Element;
use iced_cube::feedback::chip::chip;
#[derive(Debug, Clone)]
enum Message {
Remove(usize),
}
fn guests(names: &[&str]) -> Element<'static, Message> {
iced::widget::row(names.iter().enumerate().map(|(index, name)| {
chip(name.to_string())
.on_remove(Message::Remove(index))
.into()
}))
.spacing(4)
.wrap()
.into()
}Re-exports§
pub use crate::feedback::badge::Variant;
Structs§
Enums§
Functions§
- chip
- Creates a chip with a text label.
- remove_
id - The widget id of the x button of the chip with
Chip::idkey. - remove_
style - The x button style: clear until hovered or pressed, then a faint circle of the chip’s foreground colour.
- style
- The chip’s container style: the badge style of the same variant.