Components / Navigation / Number-key router

N2 · Navigation

Number-key router

Digits 1–9 and 0 switch the current view, with the legend in the footer.

When to use

  • The product is a set of peer views.
  • A legend can stay visible.

When not to use

  • The page is mostly typing.
  • Views are nested inside a form.

Usage

<div data-yr="number-key-router" tabindex="0">
  <p class="value" data-view="1">Register</p>
  <p class="sub"><kbd>1</kbd> Register <kbd>2</kbd> Schedule <kbd>0</kbd> All</p>
</div>

Variants

The preview shows the form used in the gallery.

Props

NameTypeDefaultDescription
data-viewdigit1Current view key.
data-legenddigit—Legend key that matches a view.

Keyboard

KeyAction
1–9, 0Switches the view.
Typing fieldsDigits pass through to the field.

Accessibility

Motion

Pattern origin

Pattern type: keyboard view switching.

Related

Side navPill tabsCommand menu