Getting startedComponentsDesign tokensThemingTheme synthesizerFrameworksAccessibilityUtilitiesServer renderingBrowser supportContributingChangelogApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip
ARC UIARC Radiant Components
v4.9DocsComponentsTokensSynthesizer
Getting startedFrameworksServer renderingDesign tokensThemingTheme synthesizerTypographyUtilitiesAll componentsAccessibilityBrowser supportChangelogContributingStatsApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip

Pin Input

A row of one-character boxes for entering a PIN or a one-time code.

ComponentsPin Input
inputinteractive
<arc-pin-input>

Overview

PinInput renders a row of single-character boxes. Typing a character moves focus to the next box. Backspace in an empty box moves back and clears the previous one, the left and right arrow keys move between boxes without changing them, and pasting fills the boxes from the focused one onward, skipping characters that `type` doesn't allow. `type` sets what each box accepts: `"number"` takes digits 0-9, `"alphanumeric"` takes letters and digits, and `"text"` takes any character. `type="number"` also sets `inputmode="numeric"`, so phones show a number pad. `mask` hides entered characters as dots with `-webkit-text-security: disc`. `separator` draws a dash every N boxes, so `separator="3"` on a 6-digit code shows three boxes, a dash and three more. `arc-input` fires on every entry or deletion with the partial value. When every box is filled, `arc-change` fires and then `arc-complete`, both with the full value. Listen to either to submit or validate.

Guidelines

Do

  • Set `length` to the code length, for example 4 for a PIN or 6 for a one-time code
  • Use `type="number"` for codes that are digits only
  • Turn on `mask` for security PINs
  • Give it a `label` that names the code, unless the surrounding text already does

Don't

  • Don't use it for free text. It's for fixed-length codes
  • Don't set `length` above about 8. Use a normal text input for longer codes
  • Don't pick a `separator` that leaves a short last group, like `separator="4"` on a 6-digit code
  • Don't put it in a container too narrow for its boxes and the gaps between them

Features

  • Each box is 42px wide at the default size, 34px at `sm` and 50px at `lg`

Preview

Usage

This component needs JavaScript. Use the Web Component or a framework wrapper.

<arc-pin-input label="OTP Code" length="6" separator="3"></arc-pin-input>

<script>
  document.querySelector('arc-pin-input')
    .addEventListener('arc-complete', e => {
      console.log('Code entered:', e.detail.value);
    });
</script>

API

valuestring''
Current combined value across all boxes. Reflected as an attribute.
namestring''
disabledbooleanfalse
Disables all boxes, reducing opacity to 40% and blocking input.
separatornumber0
Inserts a visual dash separator every N boxes. Set to 0 to disable separators.
labelstring''
Label text displayed above the input boxes in uppercase accent font.
lengthnumber4
Number of input boxes to render. Determines the expected code length.
type'number' | 'alphanumeric' | 'text''number'
Character validation mode. number allows digits only, alphanumeric allows letters and digits, text allows any character.
maskbooleanfalse
When true, obscures entered characters with dots for sensitive codes.
readonlybooleanfalse
Prevents entering, deleting, or pasting characters while the boxes stay focusable and the value still submits.
size'sm' | 'md' | 'lg''md'
Control size. md is the default; sm and lg scale the digit boxes.
formAssociatedbooleantrue
propertiesobject{ // flag(), unlike `disabled`. The exclusion in props.js is specifically // about form-associated *platform* semantics: a `disabled` content // attribute that is merely present makes the element actually disabled // per the HTML spec, and formDisabledCallback assigns the property back, // so no converter can win. Neither of these is platform-mapped: // `required` is enforced by _computeValidity() below and `readonly` by // each component's own interaction handlers, so the stock converter buys // nothing here and costs the usual bug: `required="false"` read as true, // blocking submission of a form the author meant to leave optional. // Finding #48's shape, across all 26 form controls at once. required: flag(false), readonly: flag(false), }
Lit merges static properties up the prototype chain, so every consumer gets these without declaring them. required participates in constraint validation below; readonly reflects for styling and is enforced by each component's interaction handlers (the mixin can't know which gestures mutate state).
autoValidatesbooleantrue
Components that run their own constraint-validation logic (pattern checks, range checks) opt out of the automatic required sync by overriding this to false, and own the whole validity flag set instead.
form
validity
validationMessage
requiredbooleanfalse

Methods

checkValidity()boolean
Whether the control currently satisfies its constraints, per the native constraint-validation API. Fires invalid on the element when it does not, and reports nothing to the user.
reportValidity()boolean
As checkValidity(), but also shows the browser's validation message against the control when it fails.

Events

arc-input
Fired on every character entry or deletion. event.detail.value contains the current partial value.
arc-change
Fired when the pin is complete: every box filled. That is the commit for a fixed-length value.
arc-complete
Fired alongside arc-change when all boxes are filled. The more specific name, kept for consumers that auto-submit.

See also