Create a `withTheme` higher-order component
See original GitHub issueIdeally, we should have a withTheme
HOC in which fields, widgets, and/or templates can be passed – this can be used to implement custom themes.
This was implemented in #1013, but that included several other breaking changes – so I’d like to see a PR which just implements the withTheme
component so it can be added to the library.
Example usage:
import withTheme from 'react-jsonschema-form/lib/components/withTheme';
import widgets from './my-theme/widgets';
import templates from './my-theme/templates';
const Form = withTheme('MyTheme', { widgets, templates });
I’m listing the popular / currently maintained libraries that fork off of react-jsonschema-form and implement a UI framework other than bootstrap 3, so that the maintainers of those repos are aware of the progress on this issue – or if anyone wants to jump in and do this, that would be great! @peterkelly @cwhatley @vip-git @selfkeyfoundation @eddyzhang1986 @twoabove @nilportugues
BS4 https://github.com/peterkelly/react-jsonschema-form-bs4 Material https://github.com/cwhatley/material-ui-react-jsonschema-form https://github.com/vip-git/react-jsonschema-form-material-ui https://github.com/SelfKeyFoundation/react-jsonschema-form-material-theme https://github.com/TwoAbove/jsonschema-form-for-material-ui Antd https://github.com/eddyzhang1986/antd-jsonschema-form Semantic UI https://github.com/nilportugues/react-jsonschema-form-semanticui
See #899
Issue Analytics
- State:
- Created 5 years ago
- Reactions:34
- Comments:28 (15 by maintainers)
@epicfaace I think that a schema like this is a good one:
This way, thanks to tree shaking, in prod only the used theme remains, and you can keep all of them in one place + keep them easily updatable.
(also keeps good compatibility with typescript, but that’s another thing 😉 )
@themakerman I’ve created
rjsf-material-ui
, which allows you to usematerial-ui v4.2
withreact-jsonschema-form
. Check it out here: https://github.com/cybertec-postgresql/rjsf-material-ui Playground: https://cybertec-postgresql.github.io/rjsf-material-ui/ Feedback is welcome!