Skip to content
v0.9.1
Forms

PIN code

Boxes for a one-time code or a PIN. It is one real input drawn as boxes, so phones can fill the code from a text message, pasting a whole code works, and screen readers read it as one field.

One-time code

Put an input in .pin. maxlength sets the number of boxes. Typing moves to the next box, Backspace goes back, and paste fills them all.

<div class="stack gap-2 items-start">
  <label class="form-label" for="pin-1">Code from your email</label>
  <div class="pin"><input id="pin-1" class="pin-input" inputmode="numeric" autocomplete="one-time-code" maxlength="6"></div>
</div>

Split, letters, hidden

data-split="3" adds a dash after every third box. data-momo-pin="text" also takes letters (shown in capitals). .pin-mask shows dots, for a PIN.

<div class="stack gap-5 items-start">
  <div class="pin" data-split="3"><input class="pin-input" inputmode="numeric" autocomplete="one-time-code" maxlength="6" aria-label="Code, 6 digits"></div>
  <div class="pin" data-momo-pin="text" data-split="4"><input class="pin-input" maxlength="8" aria-label="Recovery code"></div>
  <div class="pin pin-mask pin-sm"><input class="pin-input" inputmode="numeric" autocomplete="off" maxlength="4" aria-label="PIN"></div>
</div>

Check it

When the last box is filled the input fires momo:pin-complete. Show the result with Momo.pin.valid(el) or Momo.pin.invalid(el) (a red shake), and Momo.pin.clear(el) to start again. Add data-momo-pin-submit to the form to send it by itself. Try 246810:

No code yet?

<form class="stack gap-3 items-start" id="pin-check" onsubmit="event.preventDefault()">
  <div class="pin pin-lg"><input class="pin-input" inputmode="numeric" autocomplete="one-time-code" maxlength="6" aria-label="Verification code"></div>
  <p class="text-sm text-muted m-0">No code yet? <button class="btn btn-sm btn-ghost" type="button" onclick="Momo.pin.clear('#pin-check .pin')">Clear</button></p>
</form>

Notes

Start

OverviewStart Getting startedStart CustomizeStart

Guides

AccessibilityGuides BreakpointsGuides ChangelogGuides Customize componentsGuides JavaScriptGuides MotionGuides OptimizeGuides PhonesGuides RebootGuides Right-to-left (RTL)Guides Stacking orderGuides Using Momo with AIGuides

Foundations

ColorsFoundations TypographyFoundations ProseFoundations Images & figuresFoundations CodeFoundations Lines & shadowsFoundations Dark modeFoundations

Forms

Checkbox & switchForms ComboboxForms Date pickerForms Date rangeForms Fields & labelsForms File uploadForms Floating labelsForms Number stepperForms PasswordForms PIN codeForms RatingForms SelectForms SliderForms Tag inputForms Time pickerForms ValidationForms

Components

AccordionComponents Alert & bannerComponents AvatarComponents BadgeComponents BreadcrumbComponents ButtonComponents Button groupComponents CalendarComponents CardComponents CarouselComponents ChartsComponents ChipsComponents CollapseComponents Command paletteComponents CommentsComponents Confirm dialogsComponents Cookie bannerComponents Data tableComponents Description listComponents Dialog & toastComponents DividerComponents DrawerComponents Dropdown menuComponents Empty stateComponents File managerComponents Filter & sortComponents Gallery & lightboxComponents Inbox & chatComponents Infinite scrollComponents KanbanComponents Keyboard shortcutsComponents List groupComponents MarqueeComponents Media objectComponents Nav overflowComponents Notification centerComponents PaginationComponents ProgressComponents Pull to refreshComponents SkeletonComponents SortableComponents SpinnerComponents Split viewComponents Stat cardComponents Steps & wizardComponents Swipe actionsComponents TableComponents TabsComponents TimelineComponents TogglerComponents Tooltip & popoverComponents TourComponents Tree viewComponents VideoComponents WhiteboardComponents

Layout

Announcement barLayout App shellLayout Back to topLayout Container & sectionLayout ExamplesLayout FooterLayout HeroLayout JumbotronLayout Mega menuLayout NavbarLayout Site sidebarLayout

Sections

Bento gridSections Blog cardsSections Call to actionSections Contact & newsletterSections FAQSections FeaturesSections Logo cloudSections PricingSections TeamSections TestimonialsSections

Utilities

OverviewUtilities State variantsUtilities Display & flexUtilities Grid & gapUtilities SpacingUtilities SizingUtilities TextUtilities Links & color strengthUtilities Position & overflowUtilities BackgroundsUtilities Borders & effectsUtilities Transforms & filtersUtilities InteractionsUtilities

Helpers

Fixed, sticky & frostedHelpers Hover & focusHelpers Hover revealHelpers Icon linkHelpers PrintHelpers Relative timeHelpers Screen reader textHelpers Scroll inHelpers ScrollspyHelpers Share buttonHelpers Skip linkHelpers StacksHelpers Stretched linkHelpers Theme toggleHelpers Truncated textHelpers

Page patterns

404 pagePage patterns Coming soonPage patterns Login & registerPage patterns SettingsPage patterns ProfilePage patterns CRM contactsPage patterns ProjectsPage patterns File manager pagePage patterns Billing & plansPage patterns Help centerPage patterns Mobile app screensPage patterns
↑ ↓ moveEnter openEsc close