Pages

Skip to content

Config Provider ​

UiConfigProvider ​

Passes config such as the locale, the component used for links, and the date format to the components inside it. Use it to change the config for part of a page.

Default (en)

ja + Intl dates

Code ​

vue
<script setup lang="ts">
import { shallowRef } from 'vue'
import {
  createIntlDateFormatter,
  ja,
  UiConfigProvider,
  UiPostDate,
  UiTagFilter,
} from '@wing-land/ui'
const tag = shallowRef<string | null>(null)
const config = { locale: ja, formatDate: createIntlDateFormatter({ dateStyle: 'long' }) }
</script>
<template>
  <div class="demo">
    <section>
      <p class="label">Default (en)</p>
      <UiPostDate date="2026-10-20" kind="published" />
      <UiTagFilter v-model="tag" :tags="['Vue', 'Nuxt']" label="Tags" />
    </section>
    <UiConfigProvider :config="config">
      <section>
        <p class="label">ja + Intl dates</p>
        <UiPostDate date="2026-10-20" kind="published" />
        <UiTagFilter v-model="tag" :tags="['Vue', 'Nuxt']" label="タグ" />
      </section>
    </UiConfigProvider>
  </div>
</template>
<style scoped>
.demo {
  display: grid;
  gap: 24px;
  padding: 1rem 0;
}
section {
  display: grid;
  gap: 12px;
  justify-items: start;
}
p.label {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
</style>

Usage ​

Pass the config for the whole app to the createUi() plugin. UiConfigProvider wraps the area where part of that config is overridden. To provide config without adding a component, use provideUiConfig(). See Config for the available items.

Accessibility ​

Renders no element of its own, only the content of its default slot.

API ​

Props

PropDefaultType
configRequired

Config passed to descendants. Items you leave out are inherited from the parent config.

—UiConfigInput

Slots

SlotSlot props
default

The area the config applies to.

—