{
  "$schema": "https://www.digitaltableteur.com/schemas/contract-spec/1.0/contract.schema.json",
  "specVersion": "1.0",
  "name": "TextInput",
  "status": "stable",
  "description": "Labeled text input with validation, helper text, and size tokens.",
  "package": {
    "name": "@digitaltableteur/react",
    "import": "import { TextInput } from \"@digitaltableteur/react\";"
  },
  "props": {
    "label": {
      "type": "string",
      "optional": false,
      "description": "Visible field label; also feeds the input name (lowercased, spaces to\nhyphens) unless a name prop is passed"
    },
    "type": {
      "type": "union",
      "values": [
        "number",
        "search",
        "text",
        "tel",
        "email",
        "date",
        "time",
        "password",
        "datetime-local",
        "month",
        "week"
      ],
      "optional": false,
      "description": "Native HTML input type. Telephone values format as the user types;\ntelephone and email values validate when the field first loses focus and\nthen live as the value changes. Date/time variants retain the browser's\nlocalized picker and ISO-compatible submitted value."
    },
    "size": {
      "type": "union",
      "values": [
        "sm",
        "md",
        "lg",
        "S",
        "M",
        "L"
      ],
      "optional": true,
      "description": "Size variant for input. Defaults to `md`."
    },
    "onValueChange": {
      "type": "(value: string | number) => void",
      "optional": true,
      "description": "Value change handler (recommended)"
    },
    "defaultValue": {
      "type": "string | number",
      "optional": true,
      "description": "Initial value for uncontrolled component"
    },
    "value": {
      "type": "string | number",
      "optional": true,
      "description": "Controlled value; an initial \"\" is treated as absent (uncontrolled), later changes always sync in"
    },
    "error": {
      "type": "string",
      "optional": true,
      "description": "Validation error message; renders above the helper line and sets\naria-invalid"
    },
    "status": {
      "type": "FieldStatus",
      "optional": true,
      "description": "Semantic state: colours the border and styles statusMessage. `error` overrides it."
    },
    "statusMessage": {
      "type": "string",
      "optional": true,
      "description": "Message under the field for `status`, above the helper line"
    },
    "actions": {
      "type": "FieldAction[]",
      "optional": true,
      "description": "Icon buttons at the end of the label row: each runs an operation or opens a menu"
    },
    "helperText": {
      "type": "string",
      "optional": true,
      "description": "Helper copy below the field"
    },
    "disabled": {
      "type": "boolean",
      "optional": true,
      "description": "Disables the input. Declared explicitly (not just via the native attribute extension) so the agent-blocks prop extraction sees it."
    },
    "clearable": {
      "type": "boolean",
      "optional": true,
      "description": "Shows a labelled ×-button inside the field chrome while the field has a\nvalue; clearing returns focus to the input. Defaults to `false`."
    },
    "onClear": {
      "type": "() => void",
      "optional": true,
      "description": "Called after the clear button empties the field (onValueChange also fires with \"\")"
    },
    "hideLabel": {
      "type": "boolean",
      "optional": true,
      "description": "Visually hides the label (kept in the accessibility tree); use where\nsurrounding design carries the affordance. Defaults to `false`."
    },
    "width": {
      "type": "union",
      "values": [
        "full",
        "2ch",
        "3ch",
        "4ch",
        "5ch",
        "10ch",
        "20ch",
        "30ch"
      ],
      "optional": true,
      "description": "Widest the field grows, in characters of the expected answer (after the\nGOV.UK input widths): \"10ch\" for a code, \"30ch\" for an email address. The\nfield still shrinks with its container. Defaults to `full`."
    },
    "onChange": {
      "type": "(value: string | number) => void",
      "optional": true,
      "deprecated": {
        "reason": "Renamed to onValueChange; a development warning fires on use.",
        "replacement": "onValueChange"
      }
    }
  },
  "accessibility": {
    "criteria": [
      {
        "id": "axe-no-violations",
        "statement": "Required stories produce no axe violations at the configured severity.",
        "verification": "automated",
        "wcag": [
          "2.5.8"
        ],
        "check": "npm run test:stories:matrix:ci",
        "evidence": [
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-clearable.dark.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:39:08.670Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-clearable.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:19:49.837Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-clearable.light.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:29:49.018Z",
            "passed": true,
            "runner": "local-recapture"
          }
        ]
      },
      {
        "id": "accessibility-tree",
        "statement": "The accessibility tree (role, name, state) matches the committed snapshot for every required story.",
        "verification": "automated",
        "wcag": [
          "1.3.1",
          "4.1.2"
        ],
        "check": "npm run test:stories:matrix:ci",
        "evidence": [
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-clearable.dark.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:39:08.670Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-clearable.forced-colors.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:47:37.876Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-clearable.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:19:49.837Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-clearable.light.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:29:49.018Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-example.dark.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:39:08.739Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-example.forced-colors.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:47:37.966Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-example.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:19:49.908Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-example.light.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:29:49.096Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-forced-colors.dark.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:39:08.778Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-forced-colors.forced-colors.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:47:37.995Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-forced-colors.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:19:49.936Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-forced-colors.light.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:29:49.125Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-playground.dark.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:39:08.699Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-playground.forced-colors.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:47:37.922Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-playground.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:19:49.867Z",
            "passed": true,
            "runner": "local-recapture"
          },
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-playground.light.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:29:49.051Z",
            "passed": true,
            "runner": "local-recapture"
          }
        ]
      },
      {
        "id": "forced-colors-real-browser",
        "statement": "The component remains legible and operable under a real browser forced-colors: active pass.",
        "verification": "automated",
        "check": "npm run test:stories:hc",
        "evidence": [
          {
            "artifact": "../../../nextjs-app/shared/components/TextInput/__a11y-evidence__/forms-textinput-clearable.forced-colors.json",
            "sourceCommit": "930c562b591b6d9967e1e8c214899052624d9a2f",
            "capturedAt": "2026-11-03T22:47:37.876Z",
            "passed": true,
            "runner": "local-recapture"
          }
        ]
      },
      {
        "id": "keyboard-contract",
        "statement": "Every documented keyboard interaction works as specified.",
        "verification": "unverified",
        "wcag": [
          "2.1.1",
          "2.1.2"
        ],
        "note": "No exportable evidence record for this check; re-run the check to capture one."
      },
      {
        "id": "aria-requirements",
        "statement": "Documented ARIA roles, states, and properties are present on the rendered output.",
        "verification": "unverified",
        "wcag": [
          "4.1.2"
        ],
        "note": "No exportable evidence record for this check; re-run the check to capture one."
      },
      {
        "id": "human-a11y-review",
        "statement": "A human completed an end-to-end accessibility review of this component.",
        "verification": "manual",
        "note": "2026-05-26 — production behavior verified in Storybook; argTypes and required stories aligned with validate:components.",
        "reviewedAt": "2026-11-04"
      }
    ]
  },
  "governance": {
    "owner": "design-system",
    "lastReviewed": "2026-11-04",
    "note": "Reviewed by Petri Lahdelma; prepared by Claude from a code review on 2026-11-03"
  },
  "source": [
    "../../../nextjs-app/shared/components/TextInput/TextInput.module.css",
    "../../../nextjs-app/shared/components/TextInput/TextInput.tsx"
  ]
}
