@principlestudios/react-jotai-form-components
v0.2.1
Published
👻 Form components for use with @principlestudios/react-jotai-form
Readme
React Jotai Form Components
Provides a few basic form components for use with @principlestudios/react-jotai-forms by leveraging @principlestudios/jotai-react-signals.
Four individual imports are provided with this package:
@principlestudios/react-jotai-form-components/atom-contentsprovides a component that will render an atom passed to the children of the component within a fragment. This could be useful when rendering error messages or other React elements.import AtomContents from '@principlestudios/react-jotai-form-components/atom-contents'; <AtomContents>{atom}</AtomContents>;@principlestudios/react-jotai-form-components/inputprovides an input element that allows React to treat the input element as an uncontrolled component, but an atom passed todefaultValueordefaultCheckedwill update the element without a React rerender. Also mapsclassName,disabled, andreadOnlyto allow atoms.import JotaiInput from '@principlestudios/react-jotai-form-components/input'; <JotaiInput defaultValue={atom} />;@principlestudios/react-jotai-form-components/selectprovides a select element that allows React to treat the select element as an uncontrolled component, but an atom passed todefaultValuewill update the element without a React rerender. Also mapsclassNameanddisabledto allow atoms.import JotaiSelect from '@principlestudios/react-jotai-form-components/select'; <JotaiSelect defaultValue={atom} />;@principlestudios/react-jotai-form-components/textareaprovides a textarea element that allows React to treat the textarea element as an uncontrolled component, but an atom passed todefaultValuewill update the element without a React rerender. Also mapsclassName,disabled, andreadOnlyto allow atoms.import JotaiTextarea from '@principlestudios/react-jotai-form-components/textarea'; <JotaiTextarea defaultValue={atom} />;
