Skip to content

Be able to adjust column widths #1162

@aliabid94

Description

@aliabid94

We use gr.Row() and gr.Column() currently to configure the layout using flexbox. Currently this implementation is unintuitive for some users, so opening this issue for discussion.

Take a look at this image below:
Screen Shot 2022-05-04 at 5 43 52 PM

The current code to render this would be:

import gradio as gr

with gr.Blocks() as demo:
    gr.Markdown("# Welcome")
    gr.CheckboxGroup(["Option 1", "Option 2", "Option 3"])
    with gr.Row():
        gr.Image("cheetah1.jpg")
        gr.Image("lion.jpg")
    with gr.Row():
        btn1 = gr.Button("Load")
        btn2 = gr.Button("Save")
        with gr.Column():
            btn3 = gr.Button("Delete")
            btn4 = gr.Button("Close")
            
demo.launch()

where gr.Row() will lay out every child component in a flex row, and gr.Column() will lay out all child components in a flex column.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions