Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
forrestbao opened this issue Sep 4, 2023 · 0 comments

Comments

@forrestbao
Copy link
Member

forrestbao commented Sep 4, 2023

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}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant