XU XUv0.13.1
中文

UI / WIDGETS / Navigation

Breadcrumbs

Show the current location and navigate to ancestors

Run the Xu example

The example executes in the browser using the Xu/WASM runtime.

What to try

Click a path segment and observe the activated index.

Usage notes

Show the path from the root to the current location. Distinguish the current page from navigable ancestors and handle long paths gracefully.

Create through Screen

The Screen constructor returns a node ID. Pass that ID to Screen layout, state and event APIs. It is separate from the standalone control object documented below.

Native Xu setup fragment: call configure during initialization of an existing Screen. See the complete example for window creation, event dispatch and cleanup.

#ui/widgets

fn configure(screen $&widgets.Screen) int {
    options := ["Design","Develop","Review"]
    id := screen.breadcrumbs(&options) or >>
    screen.place(id,24.0,24.0,320.0,80.0) or >>
    << id
}

($&Screen) breadcrumbs

XuAPI
pub fn (s $&Screen) breadcrumbs(items &[]string) int

Purpose

Create Breadcrumbs in Screen and return the component node ID; throw on creation failure.

Parameters

s $&Screen
The Screen instance used by this call (exclusive borrow).
items &[]string
items (read-only borrow; caller keeps the original; type &[]string)

Returns

int — component node ID for place and other Screen methods.

Placement, state and events

The application owns the component. Screen.place positions nodes; Screen.set_enabled and Screen.set_visible control availability and visibility. Present again after state changes, handle or errors, and keep topology changes outside paint callbacks. ToastHost uses its own queue API.

Action · Styles · UI lifecycle and styling guide

Screen.place · Screen.set_enabled · Screen.set_visible

Standalone control object API

These types and methods support applications that manage control objects, input and painting directly. Their receiver is a control object, not a Screen node ID. For Screen usage, use the constructor above and the Screen methods in the Widgets module.

(&Breadcrumbs) overflow_bounds

XuAPI
pub fn (crumbs &Breadcrumbs) overflow_bounds() layout.Rect

Purpose

Operation on &Breadcrumbs: overflow bounds.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).

Returns

layout.Rect — a value of this type

(&Breadcrumbs) popup_bounds

XuAPI
pub fn (crumbs &Breadcrumbs) popup_bounds() layout.Rect

Purpose

Operation on &Breadcrumbs: popup bounds.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).

Returns

layout.Rect — a value of this type

($&Breadcrumbs) set_popup_above

XuAPI
pub fn (crumbs $&Breadcrumbs) set_popup_above(above bool)

Purpose

Operation on $&Breadcrumbs: set popup above.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
above bool
above (bool)

Returns

This call does not return a value.

($&Breadcrumbs) paint_popup_styled

XuAPI
pub fn (crumbs $&Breadcrumbs) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

Purpose

Operation on $&Breadcrumbs: paint popup styled. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
frame $&draw.Frame
frame (exclusive borrow; may modify the original; type $&draw.Frame)
styles &Styles
styles (read-only borrow; caller keeps the original; type &Styles)

Returns

int — a value of this type

struct Breadcrumbs

XuAPI
pub struct Breadcrumbs {

}

Purpose

The last item is the current location; earlier items activate navigation. Long paths are clipped consistently with hit testing, not silently wrapped.

Public fields

This type has no public fields.

(&Breadcrumbs) id

XuAPI
pub fn (crumbs &Breadcrumbs) id() int

Purpose

Return the unique integer ID of the element or control.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).

Returns

int — a value of this type

(&Breadcrumbs) bounds

XuAPI
pub fn (crumbs &Breadcrumbs) bounds() layout.Rect

Purpose

Return the bounding Rectangle of the control or geometry.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).

Returns

layout.Rect — a value of this type

(&Breadcrumbs) count

XuAPI
pub fn (crumbs &Breadcrumbs) count() int

Purpose

Return the number of items in this control.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).

Returns

int — a value of this type

(&Breadcrumbs) is_selectable

XuAPI
pub fn (crumbs &Breadcrumbs) is_selectable() bool

Purpose

Operation on &Breadcrumbs: whether it is selectable.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).

Returns

bool — true or false

($&Breadcrumbs) set_selectable

XuAPI
pub fn (crumbs $&Breadcrumbs) set_selectable(selectable bool)

Purpose

Operation on $&Breadcrumbs: set selectable.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
selectable bool
selectable (bool)

Returns

This call does not return a value.

(&Breadcrumbs) needs_paint

XuAPI
pub fn (crumbs &Breadcrumbs) needs_paint() bool

Purpose

Return whether the control needs repainting; call painted after painting to clear the flag.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).

Returns

bool — true or false

(&Breadcrumbs) visual_state

XuAPI
pub fn (crumbs &Breadcrumbs) visual_state() int

Purpose

Operation on &Breadcrumbs: visual state.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).

Returns

int — a value of this type

(&Breadcrumbs) style_or

XuAPI
pub fn (crumbs &Breadcrumbs) style_or(styles &Styles) ControlStyle

Purpose

Operation on &Breadcrumbs: style or.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).
styles &Styles
styles (read-only borrow; caller keeps the original; type &Styles)

Returns

ControlStyle — a value of this type

($&Breadcrumbs) set_style

XuAPI
pub fn (crumbs $&Breadcrumbs) set_style(style &ControlStyle) int

Purpose

Operation on $&Breadcrumbs: set style. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
style &ControlStyle
style (read-only borrow; caller keeps the original; type &ControlStyle)

Returns

int — a value of this type

($&Breadcrumbs) set_enabled

XuAPI
pub fn (crumbs $&Breadcrumbs) set_enabled(enabled bool)

Purpose

Operation on $&Breadcrumbs: set enabled.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
enabled bool
enabled (bool)

Returns

This call does not return a value.

($&Breadcrumbs) set_read_only

XuAPI
pub fn (crumbs $&Breadcrumbs) set_read_only(read_only bool) int

Purpose

Operation on $&Breadcrumbs: set read only. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
read_only bool
read_only (bool)

Returns

int — a value of this type

($&Breadcrumbs) set_bounds

XuAPI
pub fn (crumbs $&Breadcrumbs) set_bounds(bounds &layout.Rect) int

Purpose

Operation on $&Breadcrumbs: set bounds. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
bounds &layout.Rect
bounds (read-only borrow; caller keeps the original; type &layout.Rect)

Returns

int — a value of this type

($&Breadcrumbs) set_focus

XuAPI
pub fn (crumbs $&Breadcrumbs) set_focus(focused bool)

Purpose

Operation on $&Breadcrumbs: set focus.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
focused bool
focused (bool)

Returns

This call does not return a value.

($&Breadcrumbs) set_text

XuAPI
pub fn (crumbs $&Breadcrumbs) set_text(index int,text &string) int

Purpose

Operation on $&Breadcrumbs: set text. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
index int
index (int)
text &string
text (read-only borrow; caller keeps the original; type &string)

Returns

int — a value of this type

($&Breadcrumbs) apply_styles

XuAPI
pub fn (crumbs $&Breadcrumbs) apply_styles(styles &Styles) int

Purpose

Resolve and apply theme metrics to the control. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
styles &Styles
styles (read-only borrow; caller keeps the original; type &Styles)

Returns

int — a value of this type

($&Breadcrumbs) measure_styled

XuAPI
pub fn (crumbs $&Breadcrumbs) measure_styled(styles &Styles) layout.Size

Purpose

Operation on $&Breadcrumbs: measure styled. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
styles &Styles
styles (read-only borrow; caller keeps the original; type &Styles)

Returns

layout.Size — a value of this type

(&Breadcrumbs) item_bounds

XuAPI
pub fn (crumbs &Breadcrumbs) item_bounds(index int) layout.Rect

Purpose

Operation on &Breadcrumbs: item bounds. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).
index int
index (int)

Returns

layout.Rect — a value of this type

(&Breadcrumbs) cursor_at

XuAPI
pub fn (crumbs &Breadcrumbs) cursor_at(x f64,y f64) int

Purpose

Operation on &Breadcrumbs: cursor at. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs &Breadcrumbs
The Breadcrumbs instance used by this call (borrow).
x f64
value (f64)
y f64
value (f64)

Returns

int — a value of this type

($&Breadcrumbs) input

XuAPI
pub fn (crumbs $&Breadcrumbs) input(event &ui.InputEvent) Action

Purpose

Process routed mouse, keyboard, or touch input events. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
event &ui.InputEvent
event (read-only borrow; caller keeps the original; type &ui.InputEvent)

Returns

Action — input result with kind, id, repaint and focus requests.

($&Breadcrumbs) route

XuAPI
pub fn (crumbs $&Breadcrumbs) route(kind int,event &ui.InputEvent) Action

Purpose

Route and dispatch the input event to matching targets. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
kind int
kind tag (int)
event &ui.InputEvent
event (read-only borrow; caller keeps the original; type &ui.InputEvent)

Returns

Action — input result with kind, id, repaint and focus requests.

($&Breadcrumbs) paint_styled

XuAPI
pub fn (crumbs $&Breadcrumbs) paint_styled(frame $&draw.Frame,styles &Styles) int

Purpose

Operation on $&Breadcrumbs: paint styled. Throws on failure; handle the error or propagate it to the caller.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).
frame $&draw.Frame
frame (exclusive borrow; may modify the original; type $&draw.Frame)
styles &Styles
styles (read-only borrow; caller keeps the original; type &Styles)

Returns

int — a value of this type

($&Breadcrumbs) dispose

XuAPI
pub fn (crumbs $&Breadcrumbs) dispose()

Purpose

Release and dispose native resources and underlying handles.

Parameters

crumbs $&Breadcrumbs
The Breadcrumbs instance used by this call (exclusive borrow).

Returns

This call does not return a value.

Complete native example

Component Workshop · Back to Widgets