Skip to content

Awkward usage for layout_column_wrap #732

@wch

Description

@wch

The signature for layout_column_wrap is this:

def layout_column_wrap(
    width: Optional[CssUnit],
    *args: TagChild | TagAttrs,
    fixed_width: bool = False,
    heights_equal: Literal["all", "row"] = "all",
    fill: bool = True,
    fillable: bool = True,
    height: Optional[CssUnit] = None,
    height_mobile: Optional[CssUnit] = None,
    gap: Optional[CssUnit] = None,
    class_: Optional[str] = None,
    **kwargs: TagAttrValue,
) -> Tag:

This makes for kind of awkward usage. Because width comes before *args, it can never be named when the function is called (assuming you are passing in some *args, which you would always want to do). For example:

# These two don't work
layout_column_wrap(width="200px", "Hello", "world")
layout_column_wrap("Hello", "world", width="200px")

# This works
layout_column_wrap("200px", "Hello", "world")

On the other hand, height must always be named, and come after the *args. So if you want to specify both the width and height, you'd have to do this, which is awkward:

layout_column_wrap(1/2, "Hello", "world", height="300px")

Another awkward thing is that if you want to set width to None, you must call the function like this:

layout_column_wrap(None, "Hello", "world")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions