diff --git a/dev/test-studio/components/formBuilder/FormInputExample.tsx b/dev/test-studio/components/formBuilder/FormInputExample.tsx new file mode 100644 index 00000000000..04368015979 --- /dev/null +++ b/dev/test-studio/components/formBuilder/FormInputExample.tsx @@ -0,0 +1,82 @@ +import {CloseIcon, EyeOpenIcon} from '@sanity/icons' +import {Box, Button, Card, Checkbox, Flex, Inline, Stack, Text} from '@sanity/ui' +import {useState} from 'react' +import { + FormInput, + type ObjectInputProps, + type Path, + pathToString, + type RenderInputCallback, +} from 'sanity' + +export function FormInputExample(props: ObjectInputProps) { + const [path, setPath] = useState([]) + + const [includeField, setIncludeField] = useState(false) + const [includeItem, setIncludeItem] = useState(false) + + const renderDefaultForm = path.length === 0 + + const renderInput: RenderInputCallback = (inputProps) => { + // wraps each input with a button that allows rendering only the selected input + const selected = inputProps.path === path + return ( + + {props.renderInput(inputProps)} + +