<Home>

<Grid cols={[3, 4]} className="items-center">

<Hero title="Kin Form" lede="Build your field components once. Reuse them everywhere." description="A framework-agnostic form state library for TypeScript.">
  <Button href="/form/guide/getting-started">Get Started</Button>
  <PlaygroundButton>
    <PlaygroundLink name="react" href="https://stackblitz.com/github/kintools-dev/form/tree/main/examples/react" />
    <PlaygroundLink name="lit" href="https://stackblitz.com/github/kintools-dev/form/tree/main/examples/lit" />
  </PlaygroundButton>
</Hero>

<CodeGroup>

<CodeGroupItem label="npm">

```sh
# React projects (includes core).
npm add @kintools/form-react

# Lit projects (includes core).
npm add @kintools/form-lit

# Optional validators.
npm add @kintools/form-validators

# Optional: teach your coding agent Kin Form.
npx skills add kintools-dev/form
```

</CodeGroupItem>

<CodeGroupItem label="pnpm">

```sh
# React projects (includes core).
pnpm add @kintools/form-react

# Lit projects (includes core).
pnpm add @kintools/form-lit

# Optional validators.
pnpm add @kintools/form-validators

# Optional: teach your coding agent Kin Form.
pnpm dlx skills add kintools-dev/form
```

</CodeGroupItem>

<CodeGroupItem label="yarn">

```sh
# React projects (includes core).
yarn add @kintools/form-react

# Lit projects (includes core).
yarn add @kintools/form-lit

# Optional validators.
yarn add @kintools/form-validators

# Optional: teach your coding agent Kin Form.
yarn dlx skills add kintools-dev/form
```

</CodeGroupItem>

<CodeGroupItem label="bun">

```sh
# React projects (includes core).
bun add @kintools/form-react

# Lit projects (includes core).
bun add @kintools/form-lit

# Optional validators.
bun add @kintools/form-validators

# Optional: teach your coding agent Kin Form.
bunx skills add kintools-dev/form
```

</CodeGroupItem>

<CodeGroupItem label="deno">

```sh
# React projects (includes core).
deno add jsr:@kintools/form-react

# Lit projects (includes core).
deno add jsr:@kintools/form-lit

# Optional validators.
deno add jsr:@kintools/form-validators

# Optional: teach your coding agent Kin Form.
npx skills add kintools-dev/form
```

</CodeGroupItem>

</CodeGroup>

</Grid>

<Section>
<Grid cols={[3, 4]} className="items-center">
<div>

<SectionHeader>Write a field once</SectionHeader>

A field component takes a `FieldApi`, not a path or a form context. It
subscribes to that one field, so typing in it re-renders only it.

<br/>

<Cta href="/form/guide/form-composition">Build reusable field components →</Cta>

</div>
<div>

<CodeGroup>

<CodeGroupItem label="React">

```tsx {5,13}
import type { ReactNode } from "react";
import { type FieldApi, useWatch } from "@kintools/form-react";

export type TextFieldProps<TParentValue> = {
  api: FieldApi<string, TParentValue>;
  label: string;
};

export function TextField<TParentValue>(
  { api, label }: TextFieldProps<TParentValue>,
): ReactNode {
  // Re-renders only when this field changes.
  const field = useWatch(api);

  return (
    <label>
      {label}
      <input
        value={field.value}
        onBlur={field.handleBlur}
        onChange={(e) => field.handleChange(e.target.value)}
      />
      {field.touched && field.invalid && <span>{field.error}</span>}
    </label>
  );
}
```

</CodeGroupItem>

<CodeGroupItem label="Lit">

```lit {8,14}
import { html, LitElement } from "lit";
import { customElement, property } from "lit/decorators.js";
import { type FieldApi, WatchController } from "@kintools/form-lit";

@customElement("text-field")
export class TextField extends LitElement {
  @property({ attribute: false })
  accessor api!: FieldApi<string, unknown>;

  @property()
  accessor label = "";

  // Re-renders only when this field changes.
  #watch = new WatchController(this, () => this.api);

  override render() {
    const field = this.#watch.value;
    return html`
      <label>
        ${this.label}
        <input
          .value=${field.value}
          @blur=${field.handleBlur}
          @input=${(e: Event) =>
            field.handleChange((e.target as HTMLInputElement).value)}
        >
      </label>
      ${field.touched && field.invalid
        ? html`<span>${field.error}</span>`
        : ""}
    `;
  }
}
```

</CodeGroupItem>

</CodeGroup>

</div>
</Grid>
</Section>

<Section>
<Grid cols={[3, 4]} className="items-center">
<div>

<SectionHeader>Compose a form</SectionHeader>

`form.field(name, options)` resolves a `FieldApi`. The name is checked against
the form's value type, and validators attach where the field is used.

<br/>

`SubmitButton` takes the form itself, since a form is a `FieldApi` too. It's
built the same way as `TextField` above.

</div>
<div>

<CodeGroup>

<CodeGroupItem label="React">

```tsx {16,20-22,25}
import { useForm } from "@kintools/form-react";
import { email, required } from "@kintools/form-validators";

import { TextField } from "./TextField.tsx";
import { SubmitButton } from "./SubmitButton.tsx";

function ContactForm() {
  const form = useForm({
    initialValue: { name: "", email: "" },
    onSubmit: (form) => send(form.value),
  });

  return (
    <form onSubmit={form.handleSubmit}>
      <TextField
        api={form.field("name", { validators: required("Required") })}
        label="Name"
      />
      <TextField
        api={form.field("email", {
          validators: [required("Required"), email("Invalid email")],
        })}
        label="Email"
      />
      <SubmitButton api={form}>Send</SubmitButton>
    </form>
  );
}
```

</CodeGroupItem>

<CodeGroupItem label="Lit">

```lit {20-22,26-28,31}
import { html, LitElement } from "lit";
import { customElement } from "lit/decorators.js";
import { FormApi } from "@kintools/form-lit";
import { email, required } from "@kintools/form-validators";

import "./text-field.ts";
import "./submit-button.ts";

@customElement("contact-form")
class ContactForm extends LitElement {
  #form = new FormApi({
    initialValue: { name: "", email: "" },
    onSubmit: (form) => send(form.value),
  });

  override render() {
    return html`
      <form @submit=${this.#form.handleSubmit}>
        <text-field
          .api=${this.#form.field("name", {
            validators: required("Required"),
          })}
          label="Name"
        ></text-field>
        <text-field
          .api=${this.#form.field("email", {
            validators: [required("Required"), email("Invalid email")],
          })}
          label="Email"
        ></text-field>
        <submit-button .api=${this.#form}>Send</submit-button>
      </form>
    `;
  }
}
```

</CodeGroupItem>

</CodeGroup>

</div>
</Grid>
</Section>

<Section>
<Grid cols={[3, 4]} className="items-center">
<div>

<SectionHeader>Reuse a group</SectionHeader>

A group is a field whose value is an object. `AddressField` resolves its own
children from the `FieldApi` it receives, so it mounts under `billing`,
`shipping`, or any path whose value is an `Address`.

</div>
<div>

<CodeGroup>

<CodeGroupItem label="React">

```tsx {11,15-17,32-33}
import type { ReactNode } from "react";
import { type FieldApi, useForm } from "@kintools/form-react";

import { TextField } from "./TextField.tsx";
import { SubmitButton } from "./SubmitButton.tsx";

type Address = { line1: string; city: string; zip: string };
type Order = { billing: Address; shipping: Address };

function AddressField<TParentValue>(
  { api }: { api: FieldApi<Address, TParentValue> },
): ReactNode {
  return (
    <fieldset>
      <TextField api={api.field("line1")} label="Address" />
      <TextField api={api.field("city")} label="City" />
      <TextField api={api.field("zip")} label="ZIP code" />
    </fieldset>
  );
}

const emptyAddress: Address = { line1: "", city: "", zip: "" };

function OrderForm() {
  const form = useForm<Order>({
    initialValue: { billing: emptyAddress, shipping: emptyAddress },
    onSubmit: (form) => placeOrder(form.value),
  });

  return (
    <form onSubmit={form.handleSubmit}>
      <AddressField api={form.field("billing")} />
      <AddressField api={form.field("shipping")} />
      <SubmitButton api={form}>Place order</SubmitButton>
    </form>
  );
}
```

</CodeGroupItem>

<CodeGroupItem label="Lit">

```lit {14,20-22,40-41}
import { html, LitElement } from "lit";
import { customElement, property } from "lit/decorators.js";
import { type FieldApi, FormApi } from "@kintools/form-lit";

import "./text-field.ts";
import "./submit-button.ts";

type Address = { line1: string; city: string; zip: string };
type Order = { billing: Address; shipping: Address };

@customElement("address-field")
class AddressField extends LitElement {
  @property({ attribute: false })
  accessor api!: FieldApi<Address, unknown>;

  override render() {
    const { api } = this;
    return html`
      <fieldset>
        <text-field .api=${api.field("line1")} label="Address"></text-field>
        <text-field .api=${api.field("city")} label="City"></text-field>
        <text-field .api=${api.field("zip")} label="ZIP code"></text-field>
      </fieldset>
    `;
  }
}

const emptyAddress: Address = { line1: "", city: "", zip: "" };

@customElement("order-form")
class OrderForm extends LitElement {
  #form = new FormApi<Order>({
    initialValue: { billing: emptyAddress, shipping: emptyAddress },
    onSubmit: (form) => placeOrder(form.value),
  });

  override render() {
    return html`
      <form @submit=${this.#form.handleSubmit}>
        <address-field .api=${this.#form.field("billing")}></address-field>
        <address-field .api=${this.#form.field("shipping")}></address-field>
        <submit-button .api=${this.#form}>Place order</submit-button>
      </form>
    `;
  }
}
```

</CodeGroupItem>

</CodeGroup>

</div>
</Grid>
</Section>

<Section>
<Grid cols={[3, 4]} className="items-center">
<div>

<SectionHeader>Dynamic arrays</SectionHeader>

An array is a field too. A `MembersField` for one array type adds, moves, and
removes items with `pushItem`, `moveItem`, and `removeItem` on its api. Each
item keeps its own state as the list reorders, and each field's `id` is a stable
React/Lit key that follows it, no item-level id in the data needed.

</div>
<div>

<CodeGroup>

<CodeGroupItem label="React">

```tsx {10,15,18,21,25}
import { type FieldApi, useForm, useWatch } from "@kintools/form-react";

import { TextField } from "./TextField.tsx";
import { SubmitButton } from "./SubmitButton.tsx";

type Member = { name: string; email: string };
type Team = { members: Member[] };

function MembersField({ api }: { api: FieldApi<Member[], Team> }) {
  const members = useWatch(api, (f) => f.value);

  return (
    <fieldset>
      {members.map((_member, i) => (
        <div key={api.field(`${i}.name`).id}>
          <TextField api={api.field(`${i}.name`)} label="Name" />
          <TextField api={api.field(`${i}.email`)} label="Email" />
          <button disabled={i === 0} onClick={() => api.moveItem("", i, i - 1)}>
            Move up
          </button>
          <button onClick={() => api.removeItem("", i)}>Remove</button>
        </div>
      ))}

      <button onClick={() => api.pushItem("", { name: "", email: "" })}>
        Add member
      </button>
    </fieldset>
  );
}

function TeamForm() {
  const form = useForm<Team>({
    initialValue: { members: [] },
    onSubmit: (form) => save(form.value),
  });

  return (
    <form onSubmit={form.handleSubmit}>
      <MembersField api={form.field("members")} />
      <SubmitButton api={form}>Save</SubmitButton>
    </form>
  );
}
```

</CodeGroupItem>

<CodeGroupItem label="Lit">

```lit {17,23,25,39,43,50}
import { html, LitElement } from "lit";
import { customElement, property } from "lit/decorators.js";
import { repeat } from "lit/directives/repeat.js";
import { type FieldApi, FormApi, WatchController } from "@kintools/form-lit";

import "./text-field.ts";
import "./submit-button.ts";

type Member = { name: string; email: string };
type Team = { members: Member[] };

@customElement("members-field")
class MembersField extends LitElement {
  @property({ attribute: false })
  accessor api!: FieldApi<Member[], Team>;

  #members = new WatchController(this, () => this.api, (f) => f.value);

  override render() {
    const { api } = this;
    return html`
      <fieldset>
        ${repeat(
          this.#members.value,
          (_member, i) => api.field(`${i}.name`).id,
          (_member, i) =>
            html`
              <div>
                <text-field
                  .api=${api.field(`${i}.name`)}
                  label="Name"
                ></text-field>
                <text-field
                  .api=${api.field(`${i}.email`)}
                  label="Email"
                ></text-field>
                <button
                  ?disabled=${i === 0}
                  @click=${() => api.moveItem("", i, i - 1)}
                >
                  Move up
                </button>
                <button @click=${() => api.removeItem("", i)}>
                  Remove
                </button>
              </div>
            `,
        )}

        <button @click=${() => api.pushItem("", { name: "", email: "" })}>
          Add member
        </button>
      </fieldset>
    `;
  }
}

@customElement("team-form")
class TeamForm extends LitElement {
  #form = new FormApi<Team>({
    initialValue: { members: [] },
    onSubmit: (form) => save(form.value),
  });

  override render() {
    return html`
      <form @submit=${this.#form.handleSubmit}>
        <members-field .api=${this.#form.field("members")}></members-field>
        <submit-button .api=${this.#form}>Save</submit-button>
      </form>
    `;
  }
}
```

</CodeGroupItem>

</CodeGroup>

</div>
</Grid>
</Section>

<Section>
<Grid cols={[3, 4]} className="items-center">
<div>

<SectionHeader>Conditional fields</SectionHeader>

A field only exists while it's rendered. Create it inline where it's shown, and
it comes with its own validator. When the switch hides it, `unregisterField`
drops it, so a hidden field can't block submit.

<br/>

Unregistering keeps the value unless you pass `resetValue`, so whether to clear
it stays your call.

<br/>

`Watch`/`watch` here is different from the `useWatch`/`WatchController` inside a
field component: it's a render-prop that scopes a one-off re-render to a derived
condition, not a subscription owned by a component.

<br/>

<Cta href="/form/guide/conditional-fields">Conditional fields →</Cta>

</div>
<div>

<CodeGroup>

<CodeGroupItem label="React">

```tsx {16-19,32,36}
import { useForm, Watch } from "@kintools/form-react";
import { required } from "@kintools/form-validators";

import { SelectField } from "./SelectField.tsx";
import { TextField } from "./TextField.tsx";
import { SubmitButton } from "./SubmitButton.tsx";

type Signup = { type: "personal" | "business"; company: string };

function SignupForm() {
  const form = useForm<Signup>({
    initialValue: { type: "personal", company: "" },
    onSubmit: (form) => save(form.value),
  });

  const typeField = form.field("type", {
    onValueChanged: () => {
      // Drops the company field and clears its value.
      form.unregisterField("company", { resetValue: true });
    },
  });

  return (
    <form onSubmit={form.handleSubmit}>
      <SelectField api={typeField} label="Account type">
        <option value="personal">Personal</option>
        <option value="business">Business</option>
      </SelectField>

      {/* Watch is a render-prop component for one-off UI. */}
      {/* Only re-renders when the type changes. */}
      <Watch api={typeField} select={(f) => f.value === "business"}>
        {(_field, isBusiness) =>
          isBusiness && (
            <TextField
              api={form.field("company", { validators: required() })}
              label="Company"
            />
          )}
      </Watch>

      <SubmitButton api={form}>Sign up</SubmitButton>
    </form>
  );
}
```

</CodeGroupItem>

<CodeGroupItem label="Lit">

```lit {19-22,35,42-44}
import { html, LitElement } from "lit";
import { customElement } from "lit/decorators.js";
import { FormApi, watch } from "@kintools/form-lit";
import { required } from "@kintools/form-validators";

import "./select-field.ts";
import "./text-field.ts";
import "./submit-button.ts";

type Signup = { type: "personal" | "business"; company: string };

@customElement("signup-form")
class SignupForm extends LitElement {
  #form = new FormApi<Signup>({
    initialValue: { type: "personal", company: "" },
    onSubmit: (form) => save(form.value),
  });

  #typeField = this.#form.field("type", {
    onValueChanged: () => {
      // Drops the company field, validator included, and clears its value.
      this.#form.unregisterField("company", { resetValue: true });
    },
  });

  override render() {
    return html`
      <form @submit=${this.#form.handleSubmit}>
        <select-field .api=${this.#typeField} label="Account type">
          <option value="personal">Personal</option>
          <option value="business">Business</option>
        </select-field>

        <!-- Only this part re-renders when the type changes. -->
        ${watch(
          this.#typeField,
          (f) => f.value === "business",
          (_field, isBusiness) =>
            isBusiness
              ? html`
                <text-field
                  .api=${this.#form.field("company", {
                    validators: required(),
                  })}
                  label="Company"
                ></text-field>
              `
              : "",
        )}

        <submit-button .api=${this.#form}>Sign up</submit-button>
      </form>
    `;
  }
}
```

</CodeGroupItem>

</CodeGroup>

</div>
</Grid>
</Section>

<Section>
<Grid cols={[3, 4]} className="items-center">
<div>

<SectionHeader>Multiple steps</SectionHeader>

`useMultistep` (`MultistepController` in Lit) runs a wizard with one `FieldApi`
per step. `next()` validates the current step, marks its fields touched if it's
invalid, and advances only when it passes.

<br/>

<Cta href="/form/guide/multistep">Multistep forms →</Cta>

</div>
<div>

<CodeGroup>

<CodeGroupItem label="React">

```tsx {22-23,27}
import { useForm, useMultistep } from "@kintools/form-react";

import { ShippingStep } from "./ShippingStep.tsx";
import { PaymentStep } from "./PaymentStep.tsx";
import { ReviewStep } from "./ReviewStep.tsx";
import { SubmitButton } from "./SubmitButton.tsx";

type Checkout = {
  shipping: { address: string; city: string };
  payment: { cardNumber: string };
};

function CheckoutWizard() {
  const form = useForm<Checkout>({
    initialValue: {
      shipping: { address: "", city: "" },
      payment: { cardNumber: "" },
    },
    onSubmit: (form) => placeOrder(form.value),
  });

  const { stepName, stepField, isFirstStep, isLastStep, back, next } =
    useMultistep(form, ["shipping", "payment", null]);

  return (
    <form onSubmit={form.handleSubmit}>
      {stepName === "shipping" && <ShippingStep api={stepField} />}
      {stepName === "payment" && <PaymentStep api={stepField} />}
      {stepName === null && <ReviewStep form={form} />}

      {!isFirstStep && <button type="button" onClick={back}>Back</button>}
      {!isLastStep && <button type="button" onClick={next}>Next</button>}
      {isLastStep && <SubmitButton api={form}>Place order</SubmitButton>}
    </form>
  );
}
```

</CodeGroupItem>

<CodeGroupItem label="Lit">

```lit {24-28,36-38}
import { html, LitElement } from "lit";
import { customElement } from "lit/decorators.js";
import { FormApi, MultistepController } from "@kintools/form-lit";

import "./shipping-step.ts";
import "./payment-step.ts";
import "./review-step.ts";
import "./submit-button.ts";

type Checkout = {
  shipping: { address: string; city: string };
  payment: { cardNumber: string };
};

@customElement("checkout-wizard")
class CheckoutWizard extends LitElement {
  #form = new FormApi<Checkout>({
    initialValue: {
      shipping: { address: "", city: "" },
      payment: { cardNumber: "" },
    },
    onSubmit: (form) => placeOrder(form.value),
  });

  #wizard = new MultistepController(
    this,
    this.#form,
    ["shipping", "payment", null],
  );

  override render() {
    const { stepName, stepField, isFirstStep, isLastStep, back, next } =
      this.#wizard;

    return html`
      <form @submit=${this.#form.handleSubmit}>
        ${stepName === "shipping"
          ? html`<shipping-step .api=${stepField}></shipping-step>`
          : ""}
        ${stepName === "payment"
          ? html`<payment-step .api=${stepField}></payment-step>`
          : ""}
        ${stepName === null
          ? html`<review-step .form=${this.#form}></review-step>`
          : ""}

        ${!isFirstStep
          ? html`<button type="button" @click=${back}>Back</button>`
          : ""}
        ${!isLastStep
          ? html`<button type="button" @click=${next}>Next</button>`
          : ""}
        ${isLastStep
          ? html`<submit-button .api=${this.#form}>Place order</submit-button>`
          : ""}
      </form>
    `;
  }
}
```

</CodeGroupItem>

</CodeGroup>

</div>
</Grid>

<div className="mt-6">
<PlaygroundButton variant="text" label="Try it live on StackBlitz">
  <PlaygroundLink name="react" href="https://stackblitz.com/github/kintools-dev/form/tree/main/examples/react" />
  <PlaygroundLink name="lit" href="https://stackblitz.com/github/kintools-dev/form/tree/main/examples/lit" />
</PlaygroundButton>
</div>
</Section>

<Section>
<SectionHeader>Why it exists</SectionHeader>
<Prose>Kin Form is an idea that has been refined over and over after years building four admin portals (which are mostly forms) across three stacks with hand-rolled form APIs and React Hook Form. <Cta href="https://man-hoang.pages.dev/blog/why-i-built-kin-form" external>Read the full story →</Cta></Prose>
<Prose>Reusable field components <Cta href="/form/comparison/react-hook-form#group-field">become awkward</Cta> when a library treats the form as the only stateful object and fields as proxies into it. Nested objects, arrays, and shared validation then need their own special mechanisms.</Prose>
<Prose>Kin Form treats a form as a tree where every node (leaf, group, or the form itself) is the same thing, with its own state, configuration, and subscribers. That is why one component pattern works at every level.</Prose>
<Prose>Nothing forces one shape on a given value. Same <code>\{ email, address: \{ line1, line2 \} \}</code>, three valid trees:</Prose>
<Grid cols={3} divided>

<div className="flex flex-col gap-3">
<TreeDiagram viewBox="0 0 232 100" titleId="tree-one-title" title="Form with two fields: email, and address as a single leaf.">
  <TreeEdge d="M60,50 H74 V30 H88" />
  <TreeEdge d="M60,50 H74 V70 H88" />
  <TreeNode x={6} y={39} width={54} height={22} label="form" labelX={33} labelY={50} />
  <TreeNode x={88} y={19} width={54} height={22} label="email" labelX={115} labelY={30} />
  <TreeNode x={88} y={59} width={54} height={22} label="address" labelX={115} labelY={70} />
</TreeDiagram>
<TreeCaption><strong>Leaf.</strong> Any path in the value shape can be treated as a single leaf field. Here, <code>address</code> is.</TreeCaption>
</div>

<div className="flex flex-col gap-3">
<TreeDiagram viewBox="0 0 232 100" titleId="tree-two-title" title="Form with three flat fields: email, address.line1, and address.line2, all direct children of the form.">
  <TreeEdge d="M60,50 H74 V20 H88" />
  <TreeEdge d="M60,50 H74 V50 H88" />
  <TreeEdge d="M60,50 H74 V80 H88" />
  <TreeNode x={6} y={39} width={54} height={22} label="form" labelX={33} labelY={50} />
  <TreeNode x={88} y={9} width={54} height={22} label="email" labelX={115} labelY={20} />
  <TreeNode x={88} y={39} width={110} height={22} label="address.line1" labelX={143} labelY={50} />
  <TreeNode x={88} y={69} width={110} height={22} label="address.line2" labelX={143} labelY={80} />
</TreeDiagram>
<TreeCaption><strong>Flat.</strong> Every scalar is its own field, addressed by its full path.</TreeCaption>
</div>

<div className="flex flex-col gap-3">
<TreeDiagram viewBox="0 0 232 100" titleId="tree-three-title" title="Form with email as a leaf and address as a group, with line1 and line2 registered underneath it.">
  <TreeEdge d="M60,42 H74 V20 H88" />
  <TreeEdge d="M60,42 H74 V65 H88" />
  <TreeEdge d="M142,65 H156 V50 H170" />
  <TreeEdge d="M142,65 H156 V80 H170" />
  <TreeNode x={6} y={31} width={54} height={22} label="form" labelX={33} labelY={42} />
  <TreeNode x={88} y={9} width={54} height={22} label="email" labelX={115} labelY={20} />
  <TreeNode x={88} y={54} width={54} height={22} label="address" labelX={115} labelY={65} />
  <TreeNode x={170} y={39} width={54} height={22} label="line1" labelX={197} labelY={50} />
  <TreeNode x={170} y={69} width={54} height={22} label="line2" labelX={197} labelY={80} />
</TreeDiagram>
<TreeCaption><strong>Grouped.</strong> <code>address</code> becomes an intermediate node, with <code>line1</code>/<code>line2</code> registered underneath it.</TreeCaption>
</div>

</Grid>
</Section>

<Section>
  <SectionHeader>What it does differently</SectionHeader>
  <Card>
  <Grid cols={2} divided>
    <Principle title="One state machine, not two">A nested group and a leaf field are the same class, not a special case bolted onto it.</Principle>
    <Principle title="Type-safe paths"><code>field("items.0.code")</code> type-checks against your value type, so a typo'd path is a compile error.</Principle>
    <Principle title="No special-case array API">Push, insert, move, swap, and remove live on the same class every field already has, not a separate <code>useFieldArray</code> hook.</Principle>
    <Principle title="Declarative cross-field rules">List <code>dependents</code> on a field to re-validate siblings, instead of wiring a manual subscription.</Principle>
    <Principle title="Selective re-rendering">A change propagates only to the nodes it affects, so each subscriber re-renders only when the field, or selected state, it's watching actually changed.</Principle>
    <Principle title="Composable fields">Your reusable <code>TextField</code>, <code>AddressField</code>, and <code>SubmitButton</code> each take a <code>FieldApi</code>, so they work the same way whether bound to a leaf, a subtree, or the whole form.</Principle>
  </Grid>
  </Card>
</Section>

<Section>
<SectionHeader>Is Kin Form a fit?</SectionHeader>
<Card>
<Grid cols={2}>
<div>
<Lede as="h3">Use it when forms become reusable UI</Lede>
<ul className="list-disc pl-5 [&>li+li]:mt-2">
  <li>You maintain field components across forms or apps</li>
  <li>Your forms have nested groups, dynamic arrays, conditional fields, or multiple steps</li>
  <li>You need stable array item identity and narrowly scoped re-renders</li>
  <li>You want typed field paths without a separate array API</li>
  <li>You need sync or async validation, scoped per field or subtree</li>
  <li>Field state must survive UI unmounts and remounts, such as rows in a virtual list</li>
</ul>
</div>
<div>
<Lede as="h3">Skip it when the simple thing is enough</Lede>
<ul className="list-disc pl-5 [&>li+li]:mt-2">
  <li>The form is a small, one-off contact or login form</li>
  <li>Component-local state is already simpler</li>
  <li>Your team has a form-library standard that is working well and no pain worth migrating for</li>
</ul>
</div>
</Grid>
</Card>
</Section>

<Section>
  <SectionHeader>How it compares</SectionHeader>
  <FeatureMatrix full />
  <Grid cols={2} className="mt-10">
    <Card>
      <BundleSizeChart title="Bundle size (React usage, gzip)" />
    </Card>
    <Card>
      <PerformanceHighlight title="Flat field update burst (800×)" />
    </Card>
  </Grid>
  <p className="mt-6">Full comparison, including where Kin Form isn't the right fit: <Cta href="/form/comparison">see the details →</Cta></p>
</Section>

</Home>
