Skip to content

Proposal: Introducing Flexbox to Rich #1287

Answered by willmcgugan
darrenburns asked this question in Ideas
Discussion options

You must be logged in to vote

Hi Darren,

I've always taken inspiration from CSS/html when implementing Rich, so I can see how flex would be a good fit.

I think you can achieve most layouts with the current primitives. The only thing you were missing in your example is that the justify applies to text (if it was css it would probably be text-align). If your v90 panel had expand=True, you would see that the text is aligned to the right edge of the panel. To align a renderable, and not just the text contents, you can use Align.right:

from rich.align import Align
from rich.panel import Panel
from rich.table import Table
from rich.console import Console

rich_console = Console()

left = Panel("My Fancy App", expand=False)
r…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@darrenburns
Comment options

darrenburns Jun 12, 2021
Collaborator Author

Answer selected by darrenburns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants