Skip to content

(RFC) Bidirectional Layout#3303

Open
hojjatabdollahi wants to merge 5 commits intoiced-rs:masterfrom
hojjatabdollahi:hojjat/rtl-layout-root
Open

(RFC) Bidirectional Layout#3303
hojjatabdollahi wants to merge 5 commits intoiced-rs:masterfrom
hojjatabdollahi:hojjat/rtl-layout-root

Conversation

@hojjatabdollahi
Copy link
Copy Markdown
Contributor

@hojjatabdollahi hojjatabdollahi commented Apr 9, 2026

I have completed implementing RTL layout in Iced. But I have extracted a smaller piece of it with a small example in this PR to make reviewing and feedback easier.

Design

A Direction primitive is defined and added to Settings. It is then passed down to all children via Limits.
The direction for a widget can be explicitly set, or it can inherit it from its parent. You may want a part of your app to always be drawn in the same direction as you're designing for example if you have two buttons that say ", ".

There is no Auto in Direction, just LTR and RTL. The app developer can decide based on the translated language, or some other factor what the direction should be (whoever is doing i18n can decide). So, Iced doesn't need to automatically detect and change the direction.

Request

The process of updating all widgets to support the direction can be done over time and widget by widget. However, the main thing that I need your input on is the Direction primitive and how to pass it down the tree? Is this the best approach for Iced? Is the design sound? I will be working on integrating this into libcosmic, but before I do that I want to get your opinion and make sure the design is solid on you're onboard, or ideally get this merged into Iced first.

In this PR I have applied the direction to row and toggler and added a small example that shows how changing the direction in Settings would change the alignment and the order of the widgets.

Note: if you don't set the direction in the settings, everything should render exactly as before. If this feature is done right, people who don't need RTL won't notice anything!

Here's our discussion in zulip.

Here's how you set this in GTK.

@hojjatabdollahi hojjatabdollahi force-pushed the hojjat/rtl-layout-root branch from 68e24fa to a0c1275 Compare April 9, 2026 01:36
@hojjatabdollahi hojjatabdollahi force-pushed the hojjat/rtl-layout-root branch from a0c1275 to 89ec8ea Compare April 9, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant