Skip to content

Commit 2a88e5a

Browse files
committed
Merge branch '1710-Pydanticforms-basic--Boolean-checkbox-field' of github.com:workfloworchestrator/pydantic-forms-ui into 1710-Pydanticforms-basic--Boolean-checkbox-field
2 parents 160f08a + ac09d43 commit 2a88e5a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

backend/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ class TestForm(FormPage):
101101
label: Label = "Label"
102102
hidden: Hidden = "Hidden"
103103
# When there are > 3 choices a dropdown will be rendered
104-
dropdown: DropdownChoices = ("2")
104+
dropdown: DropdownChoices = "2"
105105
# When there are <= 3 choices a radio group will be rendered
106-
radio: RadioChoices = ("3")
106+
radio: RadioChoices = "3"
107+
checkbox: bool = True
107108

108109
form_data_1 = yield TestForm
109110

frontend/packages/pydantic-forms/src/components/defaultComponentMatchers.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ const defaultComponentMatchers: PydanticComponentMatcher[] = [
115115
);
116116
},
117117
},
118+
{
119+
id: 'checkbox',
120+
ElementMatch: {
121+
Element: CheckboxField,
122+
isControlledElement: true,
123+
},
124+
matcher(field) {
125+
return field.type === PydanticFormFieldType.BOOLEAN;
126+
},
127+
},
118128
];
119129

120130
// If nothing matches, it defaults to Text field in the mapToComponent function

0 commit comments

Comments
 (0)