Getting started

Actions

Forms

Layout

Navigation

Overlays

Feedback

Data display

Controllers

Helpers

Recipes

Helpers

Helpers are the decisions and formatting behind the components: date math, masks, ordering. They are plain functions with no DOM.

import { cycleValue } from '@ecopages/radiant-ui/helpers';

cycleValue(['light', 'dark', 'system'], 'system'); // 'light'

Nothing in the entry touches the DOM at import time or when called, so helpers run on the server and in tests. Anything that reads or sets DOM state is a controller utility instead. The entry is tree-shakeable. Exports whose result is not obvious carry a TSDoc example, and each page below shows the results of real calls, computed when the docs are built.

Use a helper, not a controller, for anything that only maps input to output.

PageWhat it doesReach for it when
DatesMonth grids, ISO days, selection state, locale formatting and parsing.Any calendar, scheduler or date grid.
Date segmentsThe model of a segmented date input.A date field with separate parts.
MasksPattern masks and locale date masks.Formatted text input.
Numeric rangeClamp to a stepped range, ratio to value, slider keys.Sliders, knobs and meters.
Text filterCase- and accent-insensitive contains and starts-with; type-to-find.Filtering a list as the user types; typeahead in a custom collection.
Input hintsKeyboard, Enter key and autofill attributes that agree for a kind of value.A sign-in, OTP, search or address field.
Cycle valueThe next value in a list, wrapping.A cycle toggle.
Unique idA CSS-safe, document-unique id.aria-controls and aria-labelledby targets.
OrderingWhere a dragged item lands, and key-driven moves, from rectangles.Your own drag logic, or applying a sortable onChange.
DecisionsSwipe direction from a delta and a release velocity, focus-trap wrap target, wrapped index, floating position.Custom gestures, focus loops and option lists.
Media timeTime labels, seek clamping and the buffered end of a media element.A player's time display and seek bar.
MomentumThe speed of a pointer just before release, the coast distance of a flick, the rubber band past an edge.A flick, a momentum scroll or a pull past the end.
Virtual rangeThe offsets, visible range and scroll-to position of a virtualized list.A virtualizer of your own.
SelectionToggle by selection mode, a range from an anchor and a select-all checkbox state, each honouring a selectable filter.A collection with its own selection input.
Tree collectionA flat node list as a tree: levels, positions, visible rows, and checked state with the leaf, trunk, branch and independent strategies.A tree or treegrid view rendering from data, or tree checkboxes.
Color schemeThe <head> script that applies a saved scheme before first paint, the resolved scheme for a preference and the color-scheme value to write.A theme switch and its boot script.