Skip to content

Easy association from a new type to a parametric or non-parametric widget #72

@forrestbao

Description

@forrestbao

To-do: support usage like this below where the user can different types of strings, inherited from the str type and associated with different UI components.

import funix

@funix.new_funix_type(
    widget=[
        # "MUI-TextField", 
        "textarea",
        {"min":10, "max":20 ,"multiline":True} # props of TextField in MUI
    ]
) 
class long_str(str):
    pass

type="password"@funix.new_funix_type(
    widget=[
        # "MUI-TextField", 
        "input",
        {"type":"password"} # props of TextField in MUI
    ]
) # Coming soon! 
class password(str): # For this type of strings,  the content will be hidden unless revealed
    pass

@funix.funix()
def foo(x: long_str, y: password) -> str: 
    return f"{x} {y}"

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