Peru Documento Nacional De Identidad View

PeruDocumentoNacionalDeIdentidadView is a headless read-only display of Peru's Documento Nacional de Identidad (DNI), Peru's government-issued personal identifier. It renders as a <span> with an accessible label. It is the read-only companion to PeruDocumentoNacionalDeIdentidadInput.

Status: beta — implemented and unit-tested in all seven frameworks; not yet exercised in a composed flow.

Example

PeruDocumentoNacionalDeIdentidadView
Show demo markup
<div class="peru-documento-nacional-de-identidad-view" aria-label="a read-only display of Peru's Documento Nacional de Identidad (DNI)">PeruDocumentoNacionalDeIdentidadView</div>
Usage example
<PeruDocumentoNacionalDeIdentidadView label="PeruDocumentoNacionalDeIdentidadView example"
  >Content</PeruDocumentoNacionalDeIdentidadView
>
Show Svelte source
// In your Svelte component:
import PeruDocumentoNacionalDeIdentidadView from "lily-design-system-svelte-headless/components/PeruDocumentoNacionalDeIdentidadView/PeruDocumentoNacionalDeIdentidadView.svelte";

<PeruDocumentoNacionalDeIdentidadView>
  <!-- content -->
</PeruDocumentoNacionalDeIdentidadView>

Usage

<SummaryList>
  <SummaryListItem term="Documento Nacional de Identidad (DNI)">
    <PeruDocumentoNacionalDeIdentidadView
      label="Documento Nacional de Identidad (DNI)"
      value="{value}"
    />
  </SummaryListItem>
</SummaryList>

Props

  • value: string (default: "") — the identifier to display
  • label: string (optional) — hidden text naming the value, in a .screen-reader-span. Leave it out when a visible caption names the value
  • ...restProps: any — additional HTML attributes spread onto the <span>

ARIA

  • No ARIA on the root: a plain <span> cannot be named. A visible caption names the value, or label renders as hidden text in a .screen-reader-span

When to Use

  • Use to display a stored Documento Nacional de Identidad (DNI) from Peru read-only.
  • Use in summary lists, patient records, audit logs, or detail views.
  • Use when the identifier should not be editable in the current context.

When Not to Use

  • Do not use for editing identifiers — use peru-documento-nacional-de-identidad-input instead.
  • Do not use for general text display — use a <span> directly.
  • Do not use for other countries' identifiers — use the corresponding country-specific view.

Headless

This headless component ships zero CSS. The consumer provides all styling targeting the .peru-documento-nacional-de-identidad-view class hook.

Testing

  • Verify renders a <span> with the correct class
  • Verify the value prop is rendered as text content
  • Verify label renders as hidden text, and that the root has no aria-label

Domain Knowledge

Eight digits, the Código Único de Identificación (CUI), often followed by a hyphen and a check character (10117410-2). The check character is a digit or a letter: multiply the eight digits by the weights 3, 2, 7, 6, 5, 4, 3, 2, sum them and take the remainder modulo 11, r; the digit is "65432110987"[r] and the letter "KJIHGFEDCBA"[r], and either is accepted.

Where to find it: Printed on the front of the DNI card issued by RENIEC, and asked for in almost every dealing with the state, a bank or a health service.

Security and privacy

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

  • The view shows exactly the text it is given; it does not mask. Pass the masked form (for example the last four characters) wherever the full number is not needed, and render the full number only to someone entitled to it.
  • Do not log the value, put it in a URL or query string, or send it to analytics or an error tracker.
  • Text on screen can be read over a shoulder and is kept by screenshots and screen recordings; treat a page that shows it as sensitive.

Related components

  • peru-documento-nacional-de-identidad-input — an input for entering Peru's Documento Nacional de Identidad (DNI)
  • summary-list-item — one key-value pair in a summary list

References


Lily™ and Lily Design System™ are trademarks.

Implementation Notes

  • Renders as <span>
  • Format: Eight digits, the Código Único de Identificación (CUI), often followed by a hyphen and a check character (10117410-2). The check character is a digit or a letter: multiply the eight digits by the weights 3, 2, 7, 6, 5, 4, 3, 2, sum them and take the remainder modulo 11, r; the digit is "65432110987"[r] and the letter "KJIHGFEDCBA"[r], and either is accepted.
  • Provides accessible name via the label prop
  • Companion to PeruDocumentoNacionalDeIdentidadInput

Canonical contract

Generated from this component's canonical metadata — the machine-checked source the implementations are held to.

Metadata

  • Component: peru-documento-nacional-de-identidad-view
  • PascalCase: PeruDocumentoNacionalDeIdentidadView
  • Description: a read-only display of Peru's Documento Nacional de Identidad (DNI)
  • Status: beta — implemented and unit-tested in all seven frameworks; not yet exercised in a composed flow
  • HTML tag: <span>
  • CSS class: .peru-documento-nacional-de-identidad-view
  • Interactive: no

ARIA

  • No ARIA. A plain <span> cannot be named: aria-label is prohibited on it, and most screen readers drop it. A visible caption names the value, or the optional label renders as hidden text

Keyboard

  • Not interactive

Props

  • value: string (default: "") — the identifier to display
  • label: string (optional) — hidden text naming the value, in a .screen-reader-span. Leave it out when a visible caption names the value
  • ...restProps: any additional HTML attributes spread onto the root

Markdown

This page as Markdown, for people and AI tools: peru-documento-nacional-de-identidad-view.md