Skip to content

Conversation

ChristopherBiscardi
Copy link
Contributor

Objective

There was some discussion in discord about "anchor layouts".

They are, as far as I can tell, basically absolute positioning.

Solution

Write an example that shows how to "anchor" elements to the top/left/right/bottom of a box. Also optionally included "centering" using auto margins.

Testing

cargo run --example anchor_positioning

Moving the window around changes the gray box sizes, while the interior labels are "anchored" to their respective positions, offset from their specific side attachments by 10 pixels

Showcase

screenshot-2025-09-26-at-02 17 31@2x

@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples A-UI Graphical user interfaces, styles, layouts, and widgets S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Sep 26, 2025
@alice-i-cecile
Copy link
Member

Very helpful! I'm glad that this exists.

@ChristopherBiscardi ChristopherBiscardi added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Examples An addition or correction to our examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants