Skip to content

useMessages

Override the text every component renders internally, across every language.

Every visible string a component renders itself - "Clear", "No results found", a Pagination page count, an aria-label a screen reader announces - resolves from one registry, useMessages(), rather than being hardcoded per component. Text you pass yourself (an item's own label, a column's own header) is unaffected - this registry is only for text a component supplies on its own.

Usage

Override any key globally in app.config.ts:

ts
export default defineAppConfig({
  selaras: {
    messages: {
      clear: 'Effacer',
      search: 'Rechercher...',
    },
  },
})

Only the keys you set are overridden; everything else keeps its English default. This changes every component that uses that key at once - setting close reskins the dismiss label on Modal, Toast, Input's clear button, and CommandPalette's footer hint all together, rather than needing a separate override for each.

There's no bundled translation for any other language - this registry is the mechanism, not a set of ready-made locale files. A full translation is a single object literal covering every key below.

Registry

KeyDefaultUsed by
loadingLoadingButton/Switch's loading state
clearClearInput, Select, DatePicker's clear button
closeCloseModal, Toast, CommandPalette's footer hint
cancelCancelAlertDialog's default footer
continueContinueAlertDialog's default footer
colorModeToggleToggle color modeColorModeToggle
colorPickerColor pickerColorPicker
colorPickerDescriptionDrag to adjust hue, saturation, and lightnessColorPicker's adaptive sr-only description
searchSearch...CommandPalette, Autocomplete
searchDescriptionType to filter, then use arrow keys and enter to selectSelect/Autocomplete's adaptive sr-only description
columnsColumnsTable's column-toggle control
filterPlaceholderFilter...Table's filter input
filterColumncolumn => \Filter ${column}``Accessible label and heading for a Table column filter
previousPreviousPagination, ContentSurround
nextNextPagination, ContentSurround
firstFirstPagination
lastLastPagination
stepperProgressStepper group accessible name
stepperProgress(step, total) => `Step ${step} of ${total}`Stepper live-region announcement
paginationPaginationPagination's nav aria-label
scrollTabsLeftScroll tabs leftTabs' left overflow button
scrollTabsRightScroll tabs rightTabs' right overflow button
datePickerDate pickerDatePicker
datePickerDescriptionUse arrow keys to navigate days, enter to selectDatePicker's adaptive sr-only description
dateRangePickerDate range pickerDatePicker (range mode)
dateRangePickerDescriptionUse arrow keys to navigate days, enter to select a start and end dateDatePicker (range mode)'s adaptive sr-only description
timePickerTime pickerDatePicker (time section)
timePickerDescriptionUse arrow keys to adjust the highlighted fieldDatePicker (time section)'s adaptive sr-only description
pickTimePick a timeDatePicker (timeOnly mode)
previousMonthPrevious monthDatePicker
nextMonthNext monthDatePicker
previousYearPrevious yearDatePicker
nextYearNext yearDatePicker
previousDecadePrevious decadeDatePicker (year view)
nextDecadeNext decadeDatePicker (year view)
pickDatePick a dateDatePicker
chooseMonthChoose monthDatePicker (month view)
chooseYearChoose yearDatePicker (year view)
hourHourDatePicker's time stepper
minuteMinuteDatePicker's time stepper
doneDoneDatePicker's time section
incrementIncrementInputNumber's stepper
decrementDecrementInputNumber's stepper
noOptionsNo optionsSelect, Autocomplete
selectAllSelect allListbox, TransferList
transferSourceAvailableTransferList's source heading
transferTargetAssignedTransferList's destination heading
moveToTargetAdd selectedTransferList's add button
moveToSourceRemove selectedTransferList's remove button
listSelectionCount(selected, total)${selected} of ${total} selectedTransferList's panel counts
transferItems(count, target)${count} item(s) moved to ${target}TransferList's live announcement
noResultsFoundNo results foundAutocomplete, CommandPalette
createOption(value)Create "${value}"Autocomplete's free-text suggestion
noDataNo dataTable
expandRowExpand rowTable
collapseRowCollapse rowTable
maximizeMaximizeModal's fullscreen toggle
minimizeMinimizeModal's fullscreen toggle
removeItem(label?)Remove ${label} / RemoveChip, FileUpload's remove button
moreItems(count)+${count} moreSelect/Autocomplete's chip-overflow indicator
avatarGroupOverflow(count)+${count}AvatarGroup's overflow indicator
paginationInfo(page, total)Page ${page} of ${total}Pagination
codeTabFallback(index)Tab ${index}Tabs (code block group)
copyCodeCopy codeCode block copy button
codeCopiedCopied!Code block copy feedback
dropFilesDrop files here or click to browseFileUpload
invalidFileType(name)${name}: invalid file typeFileUpload
invalidFileSize(name, max)${name}: exceeds the ${max} size limitFileUpload
tooManyFiles(max)Only ${max} file(s) allowedFileUpload
showMoreShow moreReadMore
showLessShow lessReadMore
selectFileSelect a file to view its contentFileTree
toggleSidebarToggle sidebarDashboardSidebarToggle
breadcrumbBreadcrumbBreadcrumb's nav aria-label
showHiddenBreadcrumbItemsShow hidden breadcrumb itemsBreadcrumb's overflow trigger
commandPaletteCommand paletteCommandPalette's sr-only title
commandPaletteDescriptionSearch for a command and press enterCommandPalette's sr-only description
navigateNavigateCommandPalette's footer hint
selectSelectCommandPalette's footer hint
onThisPageOn this pageContentToc's default heading
upToSize(size)Up to ${size}FileUpload's max-size hint

There's deliberately no am/pm entry: DatePicker's time section derives that text directly from useLocale via Intl, so it always matches the same locale driving the hour-cycle display next to it, rather than needing a separate translation kept in sync by hand.

API

ts
function useMessages(): ComputedRef<MessageRegistry>

Returns the merged registry (your app.config.selaras.messages overrides applied on top of the English defaults above) - use this if you're building your own component and want it to respect the same overrides a consumer already set, instead of hardcoding a string directly:

vue
<script setup lang="ts">
const messages = useMessages()
</script>

<template>
  <button :aria-label="messages.close">
    ...
  </button>
</template>
Edit this page