Practical guidance for choosing which name fields to collect, how to label them, and which Name Done endpoints to use in your forms.
Names are personal. People have different names for different contexts — a government name on official documents, a nickname friends use, a previous name from before marriage or transition, a pseudonym for privacy. The fields you design determine which of these names you receive, and how your users feel about giving them.
There is no single right way to ask for a name. The best approach depends on your context: what you will do with the name, how formal the relationship is, and whether you need to interface with third-party systems that have their own requirements.
Under UK GDPR, you should practise data minimisation — collect only what is necessary for your purpose. Before adding a name field, ask yourself: where will this name be used, and how important is it that the information is high-fidelity?
| Use case | What to collect | Name Done endpoint |
|---|---|---|
| Email newsletter greeting | First name only | firstNames() |
| Casual sign-up (let user decide) | Single “Full name” field | fullNames() |
| Formal correspondence | Title + name | formalNames() |
| School or staff records | Title + surname (pattern: title-last) | formalNames(…, { pattern: "title-last" }) |
| Official documents (passport, credit check) | Separated given + family name | firstNames() + lastNames() |
The GOV.UK Design System recommends asking for a name as a single field labelled “Full name” with no input validation (no regular expressions). This is the most socially flexible approach — it lets the user decide how they want to be referred to.
1import { createClient } from "@namedone/autocomplete"23const nd = createClient("nd_...")45// User types "john s" → "John Smith", "John Stevens"…6const { results } = await nd.fullNames("john s")More rigid, but necessary when you need to refer to someone in multiple social contexts (formal letter, email greeting, envelope) or when interfacing with third-party systems that require separated names.
1import { createClient } from "@namedone/autocomplete"23const nd = createClient("nd_...")45// First name field6const { results: firstNames } = await nd.firstNames("jo")78// Last name field9const { results: lastNames } = await nd.lastNames("sm")The GOV.UK style guide recommends different labels depending on your audience:
Asking someone to disclose whether they are “Mr”, “Mrs”, “Miss”, or “Ms” can reveal their gender and marital status. If you do not need a title, do not ask for one.
Do not use regular expressions to validate names. Names can contain letters outside A–Z (à, ñ, ü, ç), apostrophes (O’Connor), hyphens (Smith-Jones), spaces (van der Berg), and even characters from non-Latin scripts (Arabic, Chinese, Japanese). The classic article Falsehoods Programmers Believe About Names lists 40 common assumptions that turn out to be wrong.
Instead of regex validation, focus on:
If your form serves an international audience, be aware that name structures vary significantly across cultures:
If you serve an international audience, prefer a single “Full name” field. If you must separate, use “Given names” and “Family name” rather than “First name” and “Last name”.
| Endpoint | What it does | Example |
|---|---|---|
| firstNames() | Autocomplete first names by prefix | “jo” → John, Joseph, Jonathan |
| lastNames() | Autocomplete surnames by prefix | “sm” → Smith, Smyth, Smart |
| fullNames() | Combine first + last names (single field, no title) | “john s” → John Smith, John Stevens |
| formalNames() | Title + name combinations (with pattern control) | “mr j” → Mr Jones, Mr Johnson |
| titles() | Autocomplete titles by prefix | “m” → Mr, Mrs, Miss, Ms, Mx |