Oxform
Recipes

Array Fields

Manage dynamic lists with ArrayField.

Array Fields

ArrayField exposes list operations while keeping field state attached to the right entries.

import { , ,  } from '@oxform/react';
import {  } from 'zod';

const  = .({
  : .().(),
});

function () {
  const  = ({ , : { : ['alpha'] } });

  return (
    < ={} ='tags'>
      { => (
        <>
          {..((, ) => (
            < ={}>
              < ={} ={`tags.${}`}>
                { => < {....} />}
              </>
              < ='button' ={() => .()}>
                Remove
              </>
            </>
          ))}
          < ='button' ={() => .('')}>
            Add tag
          </>
        </>
      )}
    </>
  );
}