streamlit-pydantic icon indicating copy to clipboard operation
streamlit-pydantic copied to clipboard

Displaying Input Sections in Columns

Open BenediktPrusas opened this issue 3 years ago • 6 comments

Feature description: As far as I understand at the moment User Input will all be displayed in one colum. As seen here grafik But instead i would like to display the interactive fields in multile colums, As seen here: grafik

Maybe one could specify the number of input columns as name-value pair:

input_data = sp.pydantic_input(
    "model_input", model=ExampleModel, width=2
)

Additionaly if the width value equals None, the Number of Collums could be automaticly determined to approximate for e.g. a 3 by 4 aspect ratio. If the window size is to narrow streamlit rearranges the elements anyway.

Problem and motivation: The motivation is clearly to make apps with a lot of user input more organised and utilize more of wide screen displays. This is espacially sensible, since streamlit-pydantic is a usefull tool espacially in applications with a lot of user input, to make code more organised and modular.

Is this something you're interested in working on? Yes, although I am totally inexperienced

BenediktPrusas avatar Aug 23 '21 12:08 BenediktPrusas

@BenediktPrusas Thanks for your suggestion :) This would be definitely a useful feature. However, it might be a bit more complicated to implement this since we need to find a good way to automatically determine which UI elements should be put into which column. Since the different UI elements can have different sizes, just splitting them into an equal number of items might not be the desired solution. I have to do a bit of experimentation on this to get it right :)

Btw. for the use-case above, an multi-select element might also be a good alternative. You can achieve this with streamlit-pydantic by using a set of enum values (example).

lukasmasuch avatar Aug 25 '21 12:08 lukasmasuch

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

github-actions[bot] avatar Nov 24 '21 02:11 github-actions[bot]

This looks like a very good enhancement and I would love to have this too!

Maybe this could be split in something like

input_data = sp.pydantic_input(
    "model_input", model=ExampleModel, columns=[1, 3],
    preset_columns={'big_column': 1, 'small_column': 0, 'another_big_column': 1}
)

That way there will be no need to make logic about which setting should be in which column and the user can configure this for himself.

If this is not configured, than it will directly split every setting in the defined columns.

And also - I think that the streamlit column functionality should be used also with the ability to specify the column width

boris-donchev avatar Nov 29 '21 17:11 boris-donchev

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

github-actions[bot] avatar Mar 01 '22 01:03 github-actions[bot]

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

github-actions[bot] avatar Jun 15 '22 02:06 github-actions[bot]

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

github-actions[bot] avatar Sep 29 '22 02:09 github-actions[bot]

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

github-actions[bot] avatar Jan 03 '23 01:01 github-actions[bot]