How to use the @formiz/core.useField function in @formiz/core

To help you get started, we’ve selected a few @formiz/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ivan-dalmet / formiz / docs / docs / demos / components / MyField.js View on Github external
export const MyField = (props) => {
  const {
    value, setValue, errorMessage, isValid,
  } = useField(props);
  const { label } = props;
  return (
    <div>
      <label>
        { label }
      </label>
      <input type="text"> setValue(e.target.value)}
      /&gt;
      {!isValid &amp;&amp; (
        <div>
          { errorMessage }
        </div>
      )}</div>
github ivan-dalmet / formiz / examples / src / components / Fields / FieldInput.js View on Github external
export const FieldInput = (props) => {
  const {
    errorMessage,
    id,
    isValid,
    isSubmitted,
    resetKey,
    setValue,
    value,
  } = useField(props);
  const {
    label, type, required, placeholder, helper, ...otherProps
  } = props;
  const [isTouched, setIsTouched] = useState(false);
  const showError = !isValid && (isTouched || isSubmitted);

  useEffect(() => {
    setIsTouched(false);
  }, [resetKey]);

  const formGroupProps = {
    errorMessage,
    helper,
    id,
    isRequired: !!required,
    label,
github ivan-dalmet / formiz / examples / src / components / Fields / FieldSelect.js View on Github external
export const FieldSelect = (props) => {
  const {
    errorMessage,
    id,
    isValid,
    isSubmitted,
    resetKey,
    setValue,
    value,
  } = useField(props);
  const {
    label, options, required, placeholder, helper, ...otherProps
  } = props;
  const [isTouched, setIsTouched] = useState(false);
  const showError = !isValid && (isTouched || isSubmitted);

  useEffect(() => {
    setIsTouched(false);
  }, [resetKey]);

  const formGroupProps = {
    errorMessage,
    helper,
    id,
    isRequired: !!required,
    label,
github ivan-dalmet / formiz / examples / src / components / Fields / FieldTextarea.js View on Github external
export const FieldTextarea = (props) => {
  const {
    errorMessage,
    id,
    isValid,
    isSubmitted,
    resetKey,
    setValue,
    value,
  } = useField(props);
  const {
    label, required, placeholder, helper, ...otherProps
  } = props;
  const [isTouched, setIsTouched] = useState(false);
  const showError = !isValid && (isTouched || isSubmitted);

  useEffect(() => {
    setIsTouched(false);
  }, [resetKey]);

  const formGroupProps = {
    errorMessage,
    helper,
    id,
    isRequired: !!required,
    label,
github ivan-dalmet / formiz / examples / src / components / Fields / FieldPickIdenticalImages.js View on Github external
export const FieldPickIdenticalImages = (props) => {
  const {
    errorMessage,
    id,
    isValid,
    isSubmitted,
    setValue,
    value,
    valueDebounced,
  } = useField(props);
  const {
    label,
    required,
    options,
    helper,
    validMessage,
    ...otherProps
  } = props;
  const { selectedImages: selectedImagesDebounced } = valueDebounced || { selectedImages: [] };
  const showError = !isValid && (selectedImagesDebounced.length >= 2 || isSubmitted);

  const { selectedImages } = value || { selectedImages: [] };

  const formGroupProps = {
    errorMessage,
    helper,

@formiz/core

Core package for the [Formiz](https://formiz-react.com) library.

MIT
Latest version published 6 months ago

Package Health Score

62 / 100
Full package analysis

Popular @formiz/core functions

Similar packages