-
Notifications
You must be signed in to change notification settings - Fork 0
TouchArea
Drew Chase (Home) edited this page Mar 27, 2026
·
1 revision
An invisible hit-testing region that detects clicks, hovers, and drags. Lives in aurora_widgets::interactables::touch_area. Wraps a child widget and adds interaction callbacks without changing its appearance.
Use TouchArea when you need click/hover behavior on a custom widget that isn't a Button.
use aurora_ui::prelude::*;
TouchArea::new()
.child(Text::new("Click me"))
.hover_cursor(CursorIcon::Pointer)
.on_click(|event| println!("Clicked at {:?}", event.position))
.on_hover(|_rect, hovering| println!("Hover: {hovering}"))| Method | Type | Description |
|---|---|---|
child(impl Widget) |
Box<dyn Widget> |
The widget to wrap |
width(f32) |
f32 |
Fixed width (overrides child's natural size) |
height(f32) |
f32 |
Fixed height |
hover_cursor(CursorIcon) |
CursorIcon |
Cursor icon when hovering |
on_click(FnMut(&MouseClickEvent)) |
callback | Fires on mouse release inside bounds |
on_hover(FnMut(Rect, bool)) |
callback |
(bounds, is_hovered) — fires on enter/leave |
on_mouse_down(FnMut(MouseButton)) |
callback | Fires immediately on mouse press |
on_drag(FnMut(Point)) |
callback | Fires on mouse move while pressed |
use aurora_ui::prelude::*;
// Custom interactive card
TouchArea::new()
.child(
BoxWidget::new()
.width(200)
.height(100)
.background_color(Color::from_hex(0x334155, false))
.corners(Corners::all(8.0))
.child(Text::new("Drag me"))
)
.hover_cursor(CursorIcon::Grab)
.on_drag(|pos| println!("Dragging at {pos:?}"))
.on_click(|_| println!("Released"))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