Skip to content

DivHStacked / DivVStacked don't accept a gap parameter #163

Description

@linguistic76

Summary

DivHStacked and DivVStacked don't accept a gap parameter, so callers that need a non-default gap must either write the Tailwind class manually or maintain wrapper components that do the translation.

Reproduction

from monsterui.franken import DivHStacked
DivHStacked(A, B, gap=4)   # TypeError — unexpected keyword argument

Expected behaviour

DivHStacked(A, B, gap=4)   # renders with class "gap-4" applied
DivVStacked(A, B, gap=2)   # renders with class "gap-2" applied

Current workaround

Downstream code maintains wrapper components solely to translate gap=int into the corresponding Tailwind class:

def DivHStacked(*c, gap: int = 2, cls: str = "", **kwargs):
    classes = [f"flex items-center gap-{gap}"]
    if cls:
        classes.append(cls)
    return Div(*c, cls=" ".join(classes), **kwargs)

These wrappers exist only because the originals don't support gap — they add no semantic value of their own.

Suggested fix

Accept an optional gap: int | None = None keyword on both DivHStacked and DivVStacked and append f"gap-{gap}" to the class list when provided.

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