Skip to content
Tier

Initials

Pro

The first letter of each of the first two words of a name, upper-cased in locale ("Sam Rivera" is "SR"; "ilker" is "İ" in Turkish, "I" in English). Pass the page's language, useLocale().locale, as Candor's components do; left out, or not a language the browser knows, the letters are upper-cased the same in every language, so the server and the browser agree. PersonMenu and Board draw a person's initials with it; person-menu still exports it for apps that import it from there.

Markdown
Version 5.2.0· other versions

This page is for 5.2.0, the current release. An earlier release’s page is the Markdown that release published, so the docs match the version you have installed (candor-lock.json records it).

Not in the docs of 1.3.0, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0, 2.5.0, 2.5.1, 2.6.0, 2.6.1, 2.6.2, 2.7.0, 2.8.0, 2.9.0, 2.10.0, 3.0.0, 4.0.0, 4.0.1, 4.0.2, 4.1.0, 4.2.0, 4.3.0 and 4.4.0: the page came later, or had another name then.

Docs pages weren’t kept for 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.2.0 and 1.2.1: they are kept from 1.3.0 on, and before that only llms.txt was published.

Preview

It's types and helpers, listed below.

Install

With the Candor CLI

First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/initials

Brings in: tokens

Functions

initialsOf(name: string, locale?: string | undefined)
initialOf(name: string, locale?: string | undefined)

The first letter of a name alone, upper-cased in locale as initialsOf does ("Sam Rivera" is "S"). The letter is a whole grapheme where the browser can tell one (an emoji with a skin tone, a flag, a letter with its accents), and otherwise a whole code point, so a letter that takes two UTF-16 units (Adlam, an emoji) is never cut in half. ApprovalQueue's requester tile draws it.