@@ -19,6 +19,7 @@ import { Slider } from "./components/ui/slider";
1919import ReactJson from 'react-json-view' ;
2020import { RadioGroup , RadioGroupItem } from "./components/ui/radio-group"
2121import { Label } from "./components/Label/Label" ;
22+ import { Checkbox } from "./components/Checkbox/Checkbox" ;
2223
2324export function DynamicForm ( ) {
2425 const serverAddress = "localhost:8100" ;
@@ -322,28 +323,49 @@ export function DynamicForm() {
322323 case "switch" :
323324 return (
324325 < div key = { param . name } className = "flex flex-col gap-2 items-center" >
325- < div className = "flex items-center justify-between gap-2" >
326- < label >
327- { param . display_name || param . name }
328- { param . icon && < img src = { param . icon } alt = "" style = { { marginLeft : 6 } } /> }
329- </ label >
326+ < div className = "flex items-center justify-between gap-2" >
327+ < label >
328+ { param . display_name || param . name }
329+ { param . icon && < img src = { param . icon } alt = "" style = { { marginLeft : 6 } } /> }
330+ </ label >
331+ </ div >
332+ { param . description && < div className = "text-sm" > { param . description } </ div > }
333+ < Controller
334+ name = { param . name }
335+ control = { methods . control }
336+ render = { ( { field } ) => (
337+ < div className = "w-[300px]" >
338+ < Switch
339+ checked = { Boolean ( field . value === "true" ) }
340+ onCheckedChange = { ( checked ) => field . onChange ( checked . toString ( ) ) }
341+ disabled = { ( param . form_type_metadata as { disabled ?: boolean } ) ?. disabled }
342+ />
343+ </ div >
344+ ) }
345+ />
330346 </ div >
331- { param . description && < div className = "text-sm" > { param . description } </ div > }
332- < Controller
333- name = { param . name }
334- control = { methods . control }
335- render = { ( { field } ) => (
336- < div className = "w-[300px]" >
337- < Switch
338- checked = { Boolean ( field . value === "true" ) }
339- onCheckedChange = { ( checked ) => field . onChange ( checked . toString ( ) ) }
340- disabled = { ( param . form_type_metadata as { disabled ?: boolean } ) ?. disabled }
341- />
342- </ div >
343- ) }
344- />
345- </ div >
346347 )
348+ case "checkbox" :
349+ return (
350+ < div key = { param . name } className = "flex flex-col gap-2 items-center" >
351+ < div className = "flex items-center justify-between gap-2" >
352+ < label >
353+ { param . display_name || param . name }
354+ { param . icon && < img src = { param . icon } alt = "" style = { { marginLeft : 6 } } /> }
355+ </ label >
356+ </ div >
357+ { param . description && < div className = "text-sm" > { param . description } </ div > }
358+ < Controller
359+ name = { param . name }
360+ control = { methods . control }
361+ render = { ( { field } ) => (
362+ < div className = "w-[300px]" >
363+ < Checkbox checked = { Boolean ( field . value === "true" ) } onCheckedChange = { ( checked ) => field . onChange ( checked . toString ( ) ) } disabled = { ( param . form_type_metadata as { disabled ?: boolean } ) ?. disabled } />
364+ </ div >
365+ ) }
366+ />
367+ </ div >
368+ )
347369 }
348370 }
349371
0 commit comments