API reference

Tables, formatting and dates

Helpers of BaseDataTable and the formatters for numbers, money and dates.

Formatters follow the current language and NUXT_PUBLIC_DEFAULT_CURRENCY.

useTableFilters()

Resolves filter definitions (range limits from the data), counts active filters and filters items.

composables/useTableFilters.ts
useTableFilters(): { resolveFilters: <T>(filters: TableFilter[], items: T[]) => ResolvedTableFilter[]; defaultValue: (filter: ResolvedTableFilter) => TableFilterValue; isFilterActive: (filter: Resol…
ReturnsresolveFiltersdefaultValueisFilterActivecountActiveFiltersnormalizeValuesfilterItems

useTablePagination()

Builds the page buttons with ellipses and the “1–10 of 243” range.

composables/useTablePagination.ts
useTablePagination(): { buildPageItems: (page: number, pageCount: number, siblings?: number) => TablePaginationItem[]; buildRange: (page: number, itemsPerPage: number, itemsLength: number) => TablePagi…
ReturnsbuildPageItemsbuildRange

useTableSorting()

Sort and group helpers for the table menus.

composables/useTableSorting.ts
useTableSorting(): { defaultOrder: TableSortOrder; orderOptions: any; toColumnChoices: (headers: TableHeader[], allowedKeys?: string[]) => TableColumnChoice[]; toOrder: (value: unknown) => TableSort…
ReturnsdefaultOrderorderOptionstoColumnChoicestoOrdernormalizeSortItems

useNumberFormat()

currency, number and percent formatters for the current language, plus currencyCode and currencySymbol of NUXT_PUBLIC_DEFAULT_CURRENCY for field affixes such as prefix and suffix.

composables/useNumberFormat.ts
useNumberFormat(): { currencyCode: any; currencySymbol: any; currency: (value: number, options?: FormatNumberOptions) => string; number: (value: number, options?: FormatNumberOptions) => string; per…
ReturnscurrencyCodecurrencySymbolcurrencynumberpercent

useFormatLocale()

The regional locale (formatLocale of APP_LOCALES, such as es-EC) for the current language. Pass it to every Intl formatter instead of the bare i18n code. formatLocaleOf(code) and languageOf(code) resolve the format locale and the page lang (es-419) of any code outside a component.

composables/useFormatLocale.ts
useFormatLocale(): ComputedRef<string>
composables/useFormatLocale.ts
formatLocaleOf(code: string): string
composables/useFormatLocale.ts
languageOf(code: string): string

useDateDay()

Day.js helpers bound to the current language: day(date) and fromNow(date).

composables/useDateDay.ts
useDateDay(): { day: (date?: dayjs.ConfigType) => dayjs.Dayjs; fromNow: (date: dayjs.ConfigType) => string; }
ReturnsdayfromNow

useDayLabel()

Labels a date as Today, Yesterday or relative, after mount so server and browser agree.

composables/useDayLabel.ts
useDayLabel(): (date: string, { inline }?: { inline?: boolean; }) => any

useRelativeDay()

Relative times (“5 min ago”), stamps and day labels that render after mount.

composables/useRelativeDay.ts
useRelativeDay(): { time: (date: dayjs.ConfigType) => any; stamp: (date: dayjs.ConfigType) => any; dayLabel: (date: dayjs.ConfigType) => any; daysAgo: (date: dayjs.ConfigType) => any; }
ReturnstimestampdayLabeldaysAgo

useDashboardPeriod()

The period select of the dashboards (this week, month, quarter or year), kept in a cookie, with the matching comparison labels. Pair it with kpiForPeriod().

composables/useDashboardPeriod.ts
useDashboardPeriod(): { period: any; periodItems: any; comparisonLabel: any; previousLabel: any; periodPhrase: any; scale: (value: number) => number; }
ReturnsperiodperiodItemscomparisonLabelpreviousLabelperiodPhrasescale
utils/dashboard-period.ts
kpiForPeriod(kpi: T, period: DashboardPeriod, kind: DashboardMetricKind, base: DashboardPeriod = 'month'): T
Returns...kpivaluepreviousValuechangeseriespreviousSeries

useKpiCard()

The logic of BaseKpiCard: formatted value, empty state, chart scrubbing and accessible summary.

composables/useKpiCard.ts
useKpiCard(props: BaseKpiCardDefaultProps, slotFlags: MaybeRefOrGetter<KpiCardSlotFlags> = {}): { formattedValue: any; displayValue: any; isEmpty: any; isScrubbing: any; scrubCaption: any; showChart: any; haveChart: any; chartSummary: any; previousValueText: any; onScrub: (i…
ReturnsformattedValuedisplayValueisEmptyisScrubbingscrubCaptionshowCharthaveChartchartSummarypreviousValueTextonScrub
© 2026 melsami UI.
Developer documentation for melsami UI.