Skip to content

Varia

This page collects small, standalone utilities that don’t warrant their own page — focus rings, RTL support, and touch targets.

The focus utilities apply a consistent focus ring (outline) to interactive elements when they receive keyboard focus. This is a core accessibility requirement — keyboard users rely on focus indicators to know where they are on the page.

PropertyDefaultDescription
--tng-ring-color--tng-color-border-focus-neutral-defaultRing color
--tng-ring-offset2pxGap between element and ring

These can be overridden inline or in a descendant scope to customise the focus ring appearance.

Apply to any interactive element to get a focus ring on :focus-visible.

<a class="tng-focus" href="#">Link</a>

Move the focus ring to a parent element. When any child receives focus, the parent shows the ring instead. This is useful for composite controls where the visual boundary should be on the container, not the inner focusable element.

<div class="tng-focus-within border-xs border-subtle p-xl">
<button class="tng-button">Focusable Element</button>
</div>

These components implement the focus utility automatically:

ComponentFocus pattern
.tng-checkbox-controlFocus-within
.tng-controlFocus-within
.tng-list-optionFocus / Focus-within
.tng-overflow-scrollFocus (for keyboard scrolling)

For complex components that need calculations based on text direction (LTR vs RTL), the direction utility exposes a CSS variable that flips between 1 and -1.

Set .tng-direction on an element to get --tng-direction:

Direction--tng-direction value
LTR1
RTL-1

This is useful for CSS translate, rotate, or calc() expressions that need to reverse in RTL without duplicating the entire rule.

Components with built-in direction support:

ComponentWhy it’s needed
.tng-sliderTrack fill direction reverses in RTL
.tng-toggle-controlKnob slides in the opposite direction

For elements like directional icons that should mirror horizontally in RTL, use .tng-rtl-flip-x.

<span class="tng-icon icon-arrow-right | tng-rtl-flip-x"></span>

This applies scale: -1 1 when the element is inside a dir="rtl" context. Use it on:

  • Arrow icons (next, back, forward)
  • Chevrons indicating navigation direction
  • Any icon whose meaning is tied to physical left/right rather than start/end

Interactive elements must have a minimum touch target size for accessibility (WCAG 2.5.8 recommends at least 44 × 44 CSS pixels). The touch target utility enforces this using a pseudo-element overlay.

<button class="tng-touch-target tng-debug">Click Me</button>

The .tng-debug class visualises the touch target area with a red overlay — remove it in production.

ClassMin target sizeUse case
.tng-touch-target44 × 44pxButtons, links, interactive icons
.tng-touch-target-sm24 × 24pxCompact controls (e.g. close × )

These components apply the touch target automatically:

ComponentTarget size
.tng-button44 × 44px
.tng-accent-button44 × 44px
.tng-icon-button44 × 44px
.tng-link44 × 44px
.tng-accordion-trigger44 × 44px
.tng-pill-button44 × 44px
.tng-social-button44 × 44px

.tng-focus and .tng-focus-within ensure interactive elements have a visible focus indicator. Never remove or suppress focus styles — keyboard users depend on them to know where they are on the page.

The focus ring uses :focus-visible rather than :focus, which means it only appears for keyboard navigation, not for mouse clicks. This provides the best experience for both input methods.

.tng-touch-target enforces a minimum 44 × 44 CSS pixel hit area. Apply it to small interactive elements that would otherwise be difficult to tap on touch devices. The 24px variant (.tng-touch-target-sm) is available for dense UIs where the standard target is too large, but use it sparingly.

Use dir="rtl" on a parent element (typically <html> or a section) to enable right-to-left rendering. The .tng-direction utility and .tng-rtl-flip-x class ensure icons and layout calculations mirror correctly without any additional CSS overrides.