-
Notifications
You must be signed in to change notification settings - Fork 0
TagInput
A multi-value input widget with removable tags. Users type text and press Enter or comma to add a tag. Tags appear as rounded pills with an optional X button for removal. Lives in aurora_widgets::components::tag_input.
TagInput::new()
.tags(vec!["Rust", "Aurora", "UI"])
.placeholder("Add tag...")
.max_tags(10)
.removable(true)
.width(400.0)
.on_change(|tags| println!("{tags:?}"))Sets the initial list of tags.
TagInput::new().tags(vec!["Rust", "Aurora", "UI"])Sets the placeholder text shown when there are no tags and no input text. Defaults to "Add tag...".
TagInput::new().placeholder("Add framework...")Limits the maximum number of tags. When the limit is reached, new tags cannot be added.
TagInput::new().max_tags(5)Controls whether tags show an X button for removal. Defaults to true.
TagInput::new().removable(false)Sets the callback fired whenever tags are added or removed. Receives the current tag list as &[String].
TagInput::new().on_change(|tags| {
println!("tags changed: {tags:?}");
})Sets a fixed width for the widget. Without this, the widget fills available space.
TagInput::new().width(400.0)Enables or disables the error state (red border).
TagInput::new().error(true)| Property | Type | Default | Description |
|---|---|---|---|
tags |
Vec<String> |
[] |
Current list of tags |
input_text |
String |
"" |
Text being typed |
placeholder |
String |
"Add tag..." |
Placeholder text |
max_tags |
Option<usize> |
None |
Maximum number of tags |
removable |
bool |
true |
Whether tags can be removed |
width |
Option<f32> |
None |
Fixed width |
min_height |
f32 |
40.0 |
Minimum widget height |
tag_height |
f32 |
26.0 |
Height of each tag pill |
tag_spacing |
f32 |
6.0 |
Spacing between tags |
tag_color |
Color |
primary() |
Tag pill background color |
tag_text_color |
Color |
primary_foreground() |
Tag label color |
background |
Color |
background() |
Widget background color |
border_color |
Color |
input_border() |
Border color |
corners |
Corners |
6.0 all |
Corner radii |
padding |
Edges |
6, 8, 6, 8 |
Inner padding |
error |
bool |
false |
Error state |
| Key | Action |
|---|---|
| Enter | Add current input as a tag |
, (comma) |
Add current input as a tag |
| Backspace | Remove last character; if empty, remove last tag |
| Escape | Clear input and unfocus |
- Duplicate prevention: Tags are compared case-insensitively. Attempting to add a duplicate is silently ignored.
- Whitespace trimming: Leading and trailing whitespace is trimmed before adding.
- Empty input: Empty or whitespace-only input is not added as a tag.
- Flow layout: Tags wrap to the next line when they exceed the available width.
use aurora_ui::prelude::*;
use aurora_ui::aurora_widgets::components::tag_input;
fn main() {
App::new()
.title("Tag Input Example")
.run(|window, _frame_info| {
window.root(
col!()
.spacing(16.0)
.padding(Edges::all(24.0))
.child(
tag_input::TagInput::new()
.tags(vec!["Rust", "Aurora", "UI"])
.placeholder("Add tag...")
.max_tags(10)
.width(400.0)
.on_change(|tags| println!("{tags:?}")),
),
);
})
.expect("Failed to run app");
}AuroraUI is a cross-platform desktop UI framework that treats performance as a first-class constraint — not an afterthought.
- App - Application builder, windowing, and event loop
- MultiWindow - Window spawning, modals, messaging
-
Native Menu - OS menu bars (
menufeature) -
System Tray - System tray icons (
trayfeature) - Threading - Background tasks, thread-safe state
- Color - Color utilities and color schemes
- Undo / Redo - UndoStack and text input undo
- Rect - Rectangle geometry
- Point - Point geometry
- Size - Size geometry
- Edges - Edge insets (padding, margins, borders)
- Corners - Corner radii for rounded rectangles
- GpuContext - GPU surface abstraction and backends
- Canvas - 2D drawing API
- FontManager - Font loading and management
- TextLayout - Text shaping, measurement, and rendering
- Text - Text widget
- Layout - Column, Row, Stack, Positioned
- ScrollView - Scrollable viewport with scrollbar
- VirtualList - Virtualized list for large datasets
- Button - Styled button with any child content
- BoxWidget - Colored rectangle container
- TextInput - Single-line text input
- TouchArea - Invisible hit-testing region
- Drag & Drop - Draggable sources and drop zones
- ContentSwitch - Conditional child display
- Image - Raster image display (PNG, JPEG)
-
Composite - Stateful composites &
#[composite_widget] - TreeView - Hierarchical data with expand/collapse
- Display - Badge, Card, Alert, Progress, Spinner, Kbd, and more
- Stepper - Step-by-step progress indicator
- Forms - Checkbox, Switch, Slider, RadioGroup, Tabs, Accordion, and more
- SegmentedControl - iOS-style segmented toggle bar
- NumberInput - Numeric input with +/- buttons
- RichTextEditor - Rich text editing with bold/italic/underline
- Form Validation - Validators, error states, form-level validation
- Overlays - Tooltip, Popover, Dialog, DropdownMenu, Select, Toast
- Sheet - Slide-in panel from screen edge
- TagInput - Multi-value input with removable tags
- SplitPane - Resizable split view with drag handle
- ColorPicker - Color selection with hex/RGB
- TimePicker - Time selection with hour/minute spinners
- DateRangePicker - Dual-calendar date range selection
- DateTimePicker - Combined date and time selection
- Data & Advanced - Table, Calendar, Combobox, Command, and more
- Theme - Color profiles, slots, and runtime switching
- Animation - Tweens, easing, keyframes, timelines, and presets
- Syntax - Syntax highlighting for 16+ languages
- Accessibility - Screen reader support via AccessKit
- i18n - Locale detection, message formatting, RTL layout