-
Hi I am using a 3rd party library to render a form based on JSON schema (https://github.com/rjsf-team/react-jsonschema-form/, but the question applies to any other native html elements. I would like the output of this library (e.g. input tags, select tags) to look visually similar to Theme-UI's components for uniformity (I use them for other parts of the website). How can this be achieved? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This isn’t the easiest, but it’s totally doable. There are 3 parts:
So for example: <Box
as="form"
sx={{
'input[type=text],select,textarea': {
variant: 'forms.input',
display: 'block',
width: '100%',
p: 2,
appearance: 'none',
fontSize: 'inherit',
lineHeight: 'inherit'
},
label: { variant: 'forms.label', mb: 3 }
}}
>
<label>
Name:
<input type="text" name="name" />
</label>
<label>
Bio:
<textarea />
</label>
<label>
Pick your favorite flavor:
<select>
<option value="grapefruit">Grapefruit</option>
<option value="lime">Lime</option>
<option value="coconut">Coconut</option>
<option value="mango">Mango</option>
</select>
</label>
</Box> To do a more complicated one like I’ve made a more complete example here: https://repl.it/@lachlanjc/theme-ui-1038 |
Beta Was this translation helpful? Give feedback.
This isn’t the easiest, but it’s totally doable. There are 3 parts:
So for example: