Skip to content

CSS "Module" #38

Open
Open
@rgbkrk

Description

@rgbkrk

Since the style attribute has to be a dict pure code has to be written like this:

div("hello", style={
    "border": "red 3px solid",
    "padding": "10px 20px 10px 20px",
    "display": "inline-block",
    "fontWeight": "600",
    "color": "red"
})

Since I really like using keyword arguments throughout (since we use it for all the DOM properties), I sometimes use a dict, sometimes aliasing it as style:

div("hello", style=dict(
    border="red 3px solid",
    padding="10px 20px 10px 20px",
    display="inline-block",
    fontWeight="600",
    color="red"
))

# or even
style = dict
div("hello", style=style(
    border="red 3px solid",
    padding="10px 20px 10px 20px",
    display="inline-block",
    fontWeight="600",
    color="red"
))

What would you all think if we had from from vdom import style or from vdom import css, where it was just a simple function that turned all keyword arguments into the proper style dict. This would help us close #31, at least for styles.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions