# France Numero D Identification Au Repertoire Input

FranceNumeroDIdentificationAuRepertoireInput is a headless input for entering a France numéro d'identification au répertoire (NIR), the unique national healthcare identifier. It renders as `<input type="text">` with pattern validation, numeric keyboard hint, and autocomplete disabled to protect sensitive health data. It is the editable companion to FranceNumeroDIdentificationAuRepertoireView.

**Status:** beta — implemented and unit-tested in all seven frameworks with an axe-clean demo page; not yet exercised in composed flows.

The NIR is a 15-digit number printed on the Carte Vitale. The display format is `X XX XX XX XXX XXX XX` (sex, year, month, department, commune, order, control key).

## Implementation Notes

- Renders as `<input type="text">` with pattern validation
- Pattern: X XX XX XX XXX XXX XX (15 digits with spaces)
- `inputmode="numeric"` for mobile numeric keyboard
- `autocomplete="off"` to protect sensitive health identifiers
- Supports two-way binding on the `value` prop
- Companion to FranceNumeroDIdentificationAuRepertoireView

## Props

- `label`: string (required) -- accessible label via `aria-label`
- `value`: string (default: "") -- bindable input value
- `required`: boolean (default: false) -- form validation
- `disabled`: boolean (default: false) -- disabled state
- `...restProps`: any -- additional HTML attributes spread onto the `<input>`

## Usage

```html
<Field
  label="Numéro de Sécurité Sociale"
  required
>
  <FranceNumeroDIdentificationAuRepertoireInput
    label="NIR"
    value="{nir}"
    required
  />
  <Hint>Format: X XX XX XX XXX XXX XX (15 digits from your Carte Vitale)</Hint>
  <ErrorMessage>Please enter a valid NIR</ErrorMessage>
</Field>
```

## Keyboard Interactions

- Standard text input keyboard behavior
- Users type digits and spaces in the format X XX XX XX XXX XXX XX

## ARIA

- `aria-label={label}` -- provides accessible name
- `inputmode="numeric"` hints mobile devices to show a numeric keyboard

## When to Use

- Use in clinical or administrative forms to collect a French NIR / Social Security number.
- Use with validation for the NIR identifier format (X XX XX XX XXX XXX XX).
- Use in patient registration workflows where the NIR is required for healthcare reimbursement in France.

## When Not to Use

- Do not use for displaying read-only identifiers -- use FranceNumeroDIdentificationAuRepertoireView instead.
- Do not use for general text input -- use TextInput instead.
- Do not use for other national identifiers -- use the corresponding country-specific input component.

## Headless

This headless component provides a bare `<input type="text">` with `aria-label`, pattern validation, and `inputmode="numeric"`. The consumer provides all styling.

## Styles

The consumer provides all CSS styling. The component renders with a `.france-numero-d-identification-au-repertoire-input` class for targeting.

## Testing

- Verify renders an `<input>` with the correct class and type="text"
- Verify `aria-label` is set from the label prop
- Verify pattern attribute matches NIR format
- Verify `inputmode="numeric"` and `autocomplete="off"`
- Verify value binding works

## Domain Knowledge

Thirteen-digit "meaningful" code plus a two-digit check key, managed by INSEE in the Répertoire National d'Identification des Personnes Physiques (RNIPP). It encodes sex (1 male, 2 female), year and month of birth, INSEE département and commune of birth, and a serial number; commonly called the French social security number. The two-digit check key is computed as 97 minus the 13-digit number modulo 97 (Corsican département codes 2A/2B are substituted with 19/18 first) — a Modulo-97 scheme chosen because 97 is the largest prime below 100, which most reliably catches single-digit and transposition errors.

**Where to find it:** Carte Vitale health insurance card, payslips, tax forms, the Ameli health portal, France Connect, and pension correspondence.

## Security and privacy

A national identifier is personal data, and often a key to other records.

- The input renders `autocomplete="off"`, so the browser neither saves nor offers the value, and `spellcheck="false"`, so an enhanced spellchecker does not send it to a cloud service. `bin/check-identifier-inputs` keeps both in all nine catalogs.
- Do not log the value, put it in a URL or query string, or send it to analytics or an error tracker; mask it there if it must appear.
- The component stores nothing. Do not keep the value in `localStorage`, `sessionStorage` or a cookie; submit it in the body of a POST over HTTPS.
- A format or checksum check proves the number is well formed, not that it belongs to the person entering it.
- The page decides who may see it: the input does not mask what is typed. Use the matching `-view` to show it back, masked as the service requires.

## Related components

- `france-numero-d-identification-au-repertoire-view` — a read-only display of a France numéro d'identification au répertoire (NIR) unique national healthcare identifier
- `text-input` — a single-line text input field <input type="text">

## Known limitations

None known.

## References

- Ameli.fr: https://www.ameli.fr/assure/droits-demarches/principes/numero-securite-sociale

---

Lily™ and Lily Design System™ are trademarks.
