pub fn chip() -> ChipBuilderExpand description
§chip
Renders a compact chip for actions, filters, and input tokens with optional icons.
§Usage
Use for filters, suggestions, and compact actions in dense layouts.
§Parameters
variant— optional chip variant controlling default tokens and behavior.style— optional chip container style.label— visible chip label text.leading_icon— optional leading icon content.trailing_icon— optional trailing icon content.avatar— optional raster or vector input avatar; takes precedence over the leading icon and is ignored by other variants.selected— optional selected state used by selectable variants.enabled— optional enabled flag.modifier— modifier chain applied to the chip subtree.colors— optional chip color override set.border— optional chip border override.shape— optional chip shape override.shape_style— optional selectable-chip shape behavior; defaults to Expressive and is replaced by an explicitshape.elevation— optional chip elevation override.on_click— optional body click callback.on_remove— optional input-chip removal action; independent from body activation when both callbacks are provided.remove_accessibility_label— optional removal label; defaults to “Remove {label}”.accessibility_label— optional accessibility label.accessibility_description— optional accessibility description.
§Examples
use tessera_components::{chip::chip, image::ImageData};
use tessera_ui::{Callback, remember};
let selected = remember(|| false);
let toggle = Callback::new(move || selected.set(!selected.get()));
toggle.call();
assert!(selected.get());
let avatar = ImageData::from_rgba(vec![255, 128, 0, 255], 1, 1);
chip()
.input("Alex")
.avatar(avatar)
.selected(selected.get())
.on_click_shared(toggle);