> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formbase.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Remix

> Submit to Formbase from Remix actions and forms.

Remix forms run through server-side actions by default, which is ideal for Formbase. Your action can forward the form data to Formbase and return a clean success or error state to the client.

This avoids browser redirects and gives you full control over validation and UI feedback.

<Steps>
  <Step title="Create a Remix action">
    Forward the form data to Formbase from the server.

    ```tsx theme={null}
    // app/routes/contact.tsx
    import { json } from '@remix-run/node';

    export async function action({ request }) {
      const formData = await request.formData();

      const response = await fetch('https://formbase.dev/s/YOUR_FORM_ID', {
        method: 'POST',
        body: formData,
      });

      if (!response.ok) {
        return json({ ok: false, message: 'Submission failed.' }, { status: 400 });
      }

      return json({ ok: true, message: 'Submitted!' });
    }
    ```

    Because this runs on the server, Formbase responds with JSON.
  </Step>

  <Step title="Build the form">
    ```tsx theme={null}
    import { Form, useActionData } from '@remix-run/react';

    export default function ContactPage() {
      const actionData = useActionData();

      return (
        <Form method="post">
          <input name="name" placeholder="Name" required />
          <input name="email" type="email" placeholder="Email" required />
          <textarea name="message" required />
          <button type="submit">Send</button>
          {actionData?.message && <p>{actionData.message}</p>}
        </Form>
      );
    }
    ```

    Add `encType="multipart/form-data"` if you include file inputs.
  </Step>
</Steps>

<Callout type="note">
  Server actions are the recommended Remix pattern. Client-side fetch works too, but you must handle a `303` redirect response.
</Callout>
