Component

DataEnum

Published on

Description Link to section description

The DataEnum component maps a raw value to a human-readable label using a provided enum object. It renders a <data> element with the original value preserved and the mapped label displayed.

Use DataEnum when displaying statuses, types, or any value that maps to a known set of labels. For numeric formatting, use DataNumber.

Example Link to section example

Open in new tab(opens in new tab)
View HTML markup
<p><data value="active">Active</data></p>
<p><data value="inactive">Inactive</data></p>
<p><data value="pending">Pending review</data></p>
<p><data value="archived">Archived</data></p>

Accessibility Link to section accessibility

  • Renders as a <data> element with the raw value preserved in the value attribute
  • Screen readers announce the mapped label text
  • The semantic <data> element preserves the machine-readable value for assistive technologies

Variables Link to section variables

None