React-jsonschema-form component

Hi all!
I build a component based on react-jsonschema-form,

the repository is GitHub - ghost-in-moss/streamlit-react-jsonschema: streamlit component that render a form by react-jsonschema-form
which can turn a pydantic.BaseModel or its instance into a Form.

import streamlit_react_jsonschema as srj
from pydantic import BaseModel, Field


class Student(BaseModel):
    name: str = Field(description="name of the student")
    level: int = Field(description="level of the student")


class SomeClass(BaseModel):
    """
    test class of pydantic model Foo
    """
    name: Union[str, None] = Field(None, description="filed with optional[str]")
    age: int = Field(0, description="bar value")
    some_float: float = Field(description="test about float value")

    students: List[Student] = Field(default_factory=list, description="list of students")
    students_dict: Dict[str, Student] = Field(default_factory=dict, description="dict of students")


st.title("Streamlit-react-jsonschema Example")

value, submitted = srj.pydantic_form(model=SomeClass)

That is. Thanks.

2 Likes