﻿# Global configuration {#framework-fixture}

`NfConfigProvider` validates plugin registration, template types, internationalization and theme switching.


See expanded example example-34 (ConfigProviderExample).


Switch the language to update the confirm/cancel buttons and empty-state text. Confirm increments the counter; cancel resets it. Switch Chalk/OEM to change the primary button and preview border between blue `#1177ff` and green `#007555`. Language and component theme are independent.

Button labels read the language pack through `useLocale().t()`; `NfButton` does not translate custom slot content automatically. The current provider shares the application's locale context and applies its theme to the application root. This example runs in an isolated preview, so it does not change the documentation navigation's language or theme.

## Element Plus global configuration {#element-plus-config}

`NfConfigProvider` reuses all ConfigProvider props, validators and defaults from the installed Element Plus version and forwards the default scoped slot's `config`. For example, `size` controls nested `ElButton` and `ElInput` components without an explicit size; component-level props take priority. `button`, `card`, `dialog`, `link`, `table`, `message`, `zIndex`, `namespace`, `a11y`, `keyboardNavigation`, `experimentalFeatures`, `emptyValues` and `valueOnClear` are forwarded with Element Plus's native nesting/merge behavior.


See expanded example example-34 (ConfigProviderExample).


The example also demonstrates `button.autoInsertSpace`, translated Element Plus pagination and the scoped slot.

A string `locale` selects the CommonUI language and the matching built-in Element Plus language pack. Supported names are `zh-CN`, `en-US`, `ja`, `es`, `id`, `th`, `tl` and `pt`; Tagalog uses this repository's adapter. A language-pack object behaves like `ElConfigProvider`'s `locale`. An explicit `elementPlusLocale` takes precedence. Custom language names require a separate Element Plus language pack.

## Common UI global configuration {#component-defaults}

Set default props through camelCase keys such as `nfForm`, `nfTable`, `nfDrawer`, and `nfSoftphone`; template attributes may use `nf-form` or `nf-table`.

Priority: explicit component props → nearest provider → outer providers → original defaults. Merge by prop; `undefined` inherits, while `false`, `0`, and empty strings override. Arrays, objects, and functions replace whole values. Configuration is reactive; initialization options retain their existing lifecycle. Set required business data, listeners, slots, and native attributes locally.

Call `useMessage()`, `useNotification()`, and `useConfirm()` in a child setup to inherit the current provider. Direct services without context and softphone manager instances do not read the component tree.

### NfButton {#config-nf-button}

NfButton retains its legacy `mini / small / medium` sizes and does not inherit Element Plus's global `size`.

### NfButton
```vue
<script setup>
import { NfConfigProvider, NfButton } from '@94ai-plus/common-ui'
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-button="{ size: 'medium', type: 'primary' }">
    <NfButton>Global default</NfButton>
    <NfButton type="success" size="mini">Local override</NfButton>
  </NfConfigProvider>
</template>
```

### NfAction {#config-nf-action}

### NfAction
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfAction, NfButton } from '@94ai-plus/common-ui'
const result = ref('')
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-action="{ span: 2, trigger: 'click' }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <output style="margin: 0; width: 100%">{{ result }}</output>
      <NfAction>
        <NfButton @click="result = 'A'">A</NfButton>
        <NfButton @click="result = 'B'">B</NfButton>
        <NfButton @click="result = 'C'">C</NfButton>
      </NfAction>
    </div>
  </NfConfigProvider>
</template>
```

### NfAlert {#config-nf-alert}

### NfAlert
```vue
<script setup>
import { NfConfigProvider, NfAlert } from '@94ai-plus/common-ui'
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-alert="{ type: 'success', closable: false, showIcon: true }">
    <div style="display: grid; gap: 16px; width: 100%">
      <NfAlert title="Global default" />
      <NfAlert title="Local override" type="warning" :closable="true" />
    </div>
  </NfConfigProvider>
</template>
```

### NfAudio {#config-nf-audio}

### NfAudio
```vue
<script setup>
import { NfConfigProvider, NfAudio } from '@94ai-plus/common-ui'
const src = 'https://front.94ai.com/xccjh-images/%E5%B0%8F%E4%B8%83-%E5%A5%B3-%E5%93%88%E5%93%88%E5%93%88%E5%93%88%E5%93%88%E5%93%88%E5%93%88%E5%93%88.wav'
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-audio="{ size: 'small', background: false, showMoreBtn: false, initVolumnValue: 0.5 }">
    <NfAudio :src="src" />
  </NfConfigProvider>
</template>
```

### NfConditions {#config-nf-conditions}

### NfConditions
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfConditions, 规则类型, 操作类型 } from '@94ai-plus/common-ui'
const rules = ref([{ type: 规则类型.外呼次数, operator: 操作类型.大于等于, number: 1 }])
const conditions = ref([{ rules: rules.value }])
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-conditions="{ size: 'small', conditionLimit: 2, defaultAddType: 规则类型.外呼次数 }">
    <NfConditions :conditions="conditions" />
  </NfConfigProvider>
</template>
```

### NfConfirm {#config-nf-confirm}

### NfConfirm
```vue
<script setup>
import { defineComponent, h } from 'vue'
import { NfConfigProvider, NfButton, useConfirm } from '@94ai-plus/common-ui'
const Actions = defineComponent({
  setup() {
    const service = useConfirm()
    return () => h(NfButton, { onClick: () => service({ title: "Global default", message: "Name" }).then(done => done()).catch(() => {}) }, () => "Open")
  },
})
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-confirm="{ type: 'warning', width: 460 }">
    <Actions />
  </NfConfigProvider>
</template>
```

### NfMessage {#config-nf-message}

### NfMessage
```vue
<script setup>
import { defineComponent, h } from 'vue'
import { NfConfigProvider, NfButton, useMessage } from '@94ai-plus/common-ui'
const Actions = defineComponent({
  setup() {
    const service = useMessage()
    return () => h(NfButton, { onClick: () => service("Global default") }, () => "Open")
  },
})
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-message="{ type: 'success', duration: 0, showClose: true, offset: 40 }">
    <Actions />
  </NfConfigProvider>
</template>
```

### NfNotification {#config-nf-notification}

### NfNotification
```vue
<script setup>
import { defineComponent, h } from 'vue'
import { NfConfigProvider, NfButton, useNotification } from '@94ai-plus/common-ui'
const Actions = defineComponent({
  setup() {
    const service = useNotification()
    return () => h(NfButton, { onClick: () => service({ title: "Global default", message: "Name" }) }, () => "Open")
  },
})
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-notification="{ duration: 0, position: 'bottom-left' }">
    <Actions />
  </NfConfigProvider>
</template>
```

### NfDatePicker {#config-nf-date-picker}

### NfDatePicker
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfDatePicker } from '@94ai-plus/common-ui'
const value = ref('2026-01-01')
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-date-picker="{ type: 'halfyear', clearable: false, size: 'default', valueFormat: 'YYYY-MM-DD' }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfDatePicker v-model="value" />
    </div>
  </NfConfigProvider>
</template>
```

### NfDrawer {#config-nf-drawer}

### NfDrawer
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfDrawer, NfButton } from '@94ai-plus/common-ui'
const visible = ref(false)
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-drawer="{ size: '360px', showCancelButton: false }">
    <NfButton @click="visible = true">Open</NfButton>
    <NfDrawer v-model="visible" title="Global default" @confirm="done => done()">
      Name
    </NfDrawer>
  </NfConfigProvider>
</template>
```

### NfEmpty {#config-nf-empty}

### NfEmpty
```vue
<script setup>
import { NfConfigProvider, NfEmpty } from '@94ai-plus/common-ui'
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-empty="{ border: true, imageSize: 80, description: 'No data' }">
    <NfEmpty />
  </NfConfigProvider>
</template>
```

### NfForm {#config-nf-form}

### NfForm
```vue
<script setup>
import { reactive } from 'vue'
import { NfConfigProvider, NfForm, NfFormItem } from '@94ai-plus/common-ui'
import { ElInput } from 'element-plus'
const model = reactive({ name: '' })
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-form="{ size: 'default', labelWidth: '100px', columns: 2, showBtn: false }">
    <NfForm :model="model">
      <NfFormItem label="Name" prop="name"><ElInput v-model="model.name" /></NfFormItem>
    </NfForm>
  </NfConfigProvider>
</template>
```

### NfFormItem {#config-nf-form-item}

### NfFormItem
```vue
<script setup>
import { reactive } from 'vue'
import { NfConfigProvider, NfFormItem, NfForm } from '@94ai-plus/common-ui'
import { ElInput } from 'element-plus'
const model = reactive({ name: '' })
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-form-item="{ labelWidth: '120px', required: true, size: 'default' }">
    <NfForm :model="model" :show-btn="false">
      <NfFormItem label="Name" prop="name"><ElInput v-model="model.name" /></NfFormItem>
    </NfForm>
  </NfConfigProvider>
</template>
```

### NfImportTemplate {#config-nf-import-template}

### NfImportTemplate
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfImportTemplate } from '@94ai-plus/common-ui'
const clicked = ref(0)
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-import-template="{ tipDirection: 'horizontal', btnText: 'Download', order: '1' }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <output style="margin: 0; width: 100%">{{ clicked }}</output>
      <NfImportTemplate description="Import template" @click="clicked++" />
    </div>
  </NfConfigProvider>
</template>
```

### NfIndicatorPlane {#config-nf-indicator-plane}

### NfIndicatorPlane
```vue
<script setup>
import { NfConfigProvider, NfIndicatorPlane } from '@94ai-plus/common-ui'
const data = { count: 128, name: "Total", rate: '98%', desc: "Success rate", unit: '' }
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-indicator-plane="{ scene: 3 }">
    <NfIndicatorPlane :data="data" />
  </NfConfigProvider>
</template>
```

### NfInfiniteMenu {#config-nf-infinite-menu}

### NfInfiniteMenu
```vue
<script setup>
import { NfConfigProvider, NfInfiniteMenu } from '@94ai-plus/common-ui'
const data = [{ index: '1', name: 'Alpha' }, { index: '2', name: 'Beta', children: [{ index: '2-1', name: 'Beta 1' }] }]
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-infinite-menu="{ router: false, mode: 'horizontal', ellipsis: false }">
    <NfInfiniteMenu :data="data" />
  </NfConfigProvider>
</template>
```

### NfKeywords {#config-nf-keywords}

### NfKeywords
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfKeywords } from '@94ai-plus/common-ui'
const value = ref([])
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-keywords="{ singleLimit: 20, totalLimit: 100, placeholder: 'Enter keywords' }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfKeywords v-model="value" />
    </div>
  </NfConfigProvider>
</template>
```

### NfLazySelect {#config-nf-lazy-select}

### NfLazySelect
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfLazySelect } from '@94ai-plus/common-ui'
const value = ref([])
const options = Array.from({ length: 24 }, (_, index) => ({ label: 'Option ' + (index + 1), value: index + 1 }))
async function request({ pageNo = 1, pageSize = 5, keyword = '' }) {
  await new Promise(resolve => setTimeout(resolve, 200))
  const rows = options.filter(item => item.label.toLowerCase().includes(keyword.toLowerCase()))
  return { records: rows.slice((pageNo - 1) * pageSize, pageNo * pageSize), total: rows.length }
}
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-lazy-select="{ pageSize: 5, multiple: true, filterable: true, clearable: true }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfLazySelect v-model="value" :request="request" style="width: 260px; max-width: 100%" />
    </div>
  </NfConfigProvider>
</template>
```

### NfPopupLazySelect {#config-nf-popup-lazy-select}

### NfPopupLazySelect
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfPopupLazySelect, NfButton } from '@94ai-plus/common-ui'
const value = ref()
const options = Array.from({ length: 24 }, (_, index) => ({ label: 'Option ' + (index + 1), value: index + 1 }))
async function request({ pageNo = 1, pageSize = 5, keyword = '' }) {
  await new Promise(resolve => setTimeout(resolve, 200))
  const rows = options.filter(item => item.label.toLowerCase().includes(keyword.toLowerCase()))
  return { records: rows.slice((pageNo - 1) * pageSize, pageNo * pageSize), total: rows.length }
}
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-popup-lazy-select="{ popupWidth: 280, pageSize: 5, popdownOnSelect: true }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfPopupLazySelect v-model="value" :request="request">
        <NfButton>Please select</NfButton>
      </NfPopupLazySelect>
    </div>
  </NfConfigProvider>
</template>
```

### NfRadioGroup {#config-nf-radio-group}

### NfRadioGroup
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfRadioGroup } from '@94ai-plus/common-ui'
const value = ref('a')
const groups = [{ name: 'Alpha', value: 'a' }, { name: 'Beta', value: 'b' }]
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-radio-group="{ size: 'medium' }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfRadioGroup v-model="value" :groups="groups" />
    </div>
  </NfConfigProvider>
</template>
```

### NfResizablePanels {#config-nf-resizable-panels}

Drag the divider to resize the panels.

### NfResizablePanels
```vue
<script setup>
import { NfConfigProvider, NfResizablePanels } from '@94ai-plus/common-ui'
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-resizable-panels="{ dragDirection: 'row', seperatorSize: 8, symbolMode: 'symbol' }">
    <NfResizablePanels style="height: 140px">
      <div style="flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; min-width: 0">Left</div>
      <div style="flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; min-width: 0">Right</div>
    </NfResizablePanels>
  </NfConfigProvider>
</template>
```

### NfRules {#config-nf-rules}

### NfRules
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfRules, 规则类型, 操作类型 } from '@94ai-plus/common-ui'
const rules = ref([{ type: 规则类型.外呼次数, operator: 操作类型.大于等于, number: 1 }])
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-rules="{ size: 'small', limit: 3, defaultAddType: 规则类型.外呼次数 }">
    <NfRules :rules="rules" />
  </NfConfigProvider>
</template>
```

### NfSearchForm {#config-nf-search-form}

### NfSearchForm
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfSearchForm } from '@94ai-plus/common-ui'
const model = ref({ name: '' })
const fields = [{ prop: 'name', label: "Name", element: 'el-input' }]
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-search-form="{ columns: 2, btnItems: ['search', 'reset'], columnEdit: false, showBtn: false }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ model }}</pre>
      <NfSearchForm v-model="model" :form-options="fields" />
    </div>
  </NfConfigProvider>
</template>
```

### NfSoftphone {#config-nf-softphone}

Global defaults disable auto-start and configure the phone language, OEM theme, and PC mode. This follows the softphone documentation’s async onMounted example: it renders an unconnected preview bar by default, and obtains a signature to initialize the live phone bar after entering test `appKey`, `appSecret`, and `agentTag` values in the editor.

### NfSoftphone
```vue
<script lang='ts' setup>
import {
  nextTick,
  onMounted,
  onUnmounted,
  ref
} from 'vue'
import { NfConfigProvider, NfSoftphone, createSoftphoneSign } from '@94ai-plus/common-ui'

const sign = ref('')
const timestamp = ref(Date.now())

// Fill in the three fields below for integration testing; leave empty to show the unconnected preview.
// In production, generate signatures on your backend and do not keep secrets in frontend code.
const appKey = ''
const appSecret = ''
const agentTag = ''
const configured = Boolean(appKey.trim() && appSecret.trim() && agentTag.trim())

const nfSoftPhone1 = ref()
const commonSoftphone = ref()
const loading = ref(configured)
const ready = ref(false)
const initError = ref('')
let disposed = false

onUnmounted(() => { disposed = true })
onMounted(async () => {
  if (!configured) return
  try {
    const signedAt = Date.now()
    const nextSign = await createSoftphoneSign(appKey, signedAt, appSecret, {
      // env: 'sg',
      // cryptoJsUrl: '',
    })
    if (disposed) return // An already-running async onMounted does not stop automatically on unmount
    timestamp.value = signedAt
    sign.value = nextSign
    ready.value = true
    await nextTick() // Synchronize the latest signature and timestamp to child props before manual startup.
    if (disposed) return
    loading.value = false
    await nfSoftPhone1.value?.initSoftphone()
  } catch (error) {
    if (!disposed) {
      loading.value = false
      initError.value = error instanceof Error ? error.message : String(error)
    }
  }
})

const softphoneConnectCallBack1 = async (data) => {
  console.log('softphone-connect1', data)
  commonSoftphone.value  = data.commonSoftphone
  // await (await data.commonSoftphone.getUserAgentManager()).toggleNap(false)
  // commonSoftphone.value.getUserAgentManagerSync().callNumber('15018707394')
}
const softphoneCallRefreshCallBack1 = (data) => {
  console.log('softphone-call-refresh1', data)
}
const softphoneSeatStatusChangeCallBack1 = (data) => {
  console.log('softphone-seats-status-change1', data)
}
const softphoneAcceptCallBack1 = (data) => {
  console.log('softphone-accept1', data)
}
const softphoneIgnoreCallBack1 = (data) => {
  console.log('softphone-ignore1', data)
}
const softphoneHangupCallBack1 = (data) => {
  console.log('softphone-hangup1', data)
}
const softphoneAutoIgnoreCallback1 = (data) => {
  console.log('softphone-auto-ignore-callback1', data)
}
const softphoneSessionStateChangeCallBack1 = (data) => {
  console.log('softphone-session-state-change1', data)
}
const softphoneIncomingCallBack1 = (data) => {
  console.log('softphone-incoming1', data)
}
const softphoneSendDtmfCallBack1 = (data) => {
  console.log('softphone-send-dtmf1', data)
}
const softphoneConnectRegisteredCallBack1 = (data) => {
  console.log('softphone-connect-registered1', data)
}

const softphoneSignOverduedCallBack1 = async (done) => {
  console.log('softphone-sign-overdued1')
  const timestamp = Date.now()
  done({
    timestamp,
    sign: await createSoftphoneSign(appKey, timestamp, appSecret)
  })
} // Refresh the signature when it expires

</script>

<template>
  <NfConfigProvider locale="en-US" :nf-softphone="{ autoStart: false, isOem: true, accessMode: 'pc', lang: 'en' }">
    <!-- Documentation preview and loading indicator; in production apps you can keep only the inner phone bar. -->
    <doc-phone-preview :active="ready" :loading="loading" :failed="Boolean(initError)" :error-text="initError">
      <NfSoftphone
        v-if="ready"
        ref="nfSoftPhone1"

        :agentTag="agentTag"
        :appKey="appKey"
        v-model:sign="sign"
        v-model:timestamp="timestamp"
        extStatus="1"

        name="config-provider-softphone-en"
        destination-origin="config-provider-softphone-en"
        ancestor-origin="config-provider-softphone-en"

        @softphone-connect="softphoneConnectCallBack1"
        @softphone-call-refresh="softphoneCallRefreshCallBack1"
        @softphone-seats-status-change="softphoneSeatStatusChangeCallBack1"
        @softphone-accept="softphoneAcceptCallBack1"
        @softphone-ignore="softphoneIgnoreCallBack1"
        @softphone-hangup="softphoneHangupCallBack1"
        @softphone-auto-ignore-callback="softphoneAutoIgnoreCallback1"
        @softphone-session-state-change="softphoneSessionStateChangeCallBack1"
        @softphone-incoming="softphoneIncomingCallBack1"
        @softphone-send-dtmf="softphoneSendDtmfCallBack1"
        @softphone-connect-registered="softphoneConnectRegisteredCallBack1"
        @softphone-sign-overdued="softphoneSignOverduedCallBack1"
      />
    </doc-phone-preview>
  </NfConfigProvider>
</template>
```

### NfTable {#config-nf-table}

### NfTable
```vue
<script setup>
import { NfConfigProvider, NfTable } from '@94ai-plus/common-ui'
const rows = [{ id: 1, name: 'Alpha' }, { id: 2, name: 'Beta' }]
const columns = [{ prop: 'id', label: 'ID' }, { prop: 'name', label: "Name" }]
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-table="{ calHeight: false, columnEdit: false, tableAttrs: { stripe: true, size: 'small' } }">
    <NfTable :data="rows" :columns="columns" :init-search-api="false" />
  </NfConfigProvider>
</template>
```

### NfTag {#config-nf-tag}

### NfTag
```vue
<script setup>
import { NfConfigProvider, NfTag } from '@94ai-plus/common-ui'
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-tag="{ type: 'success', circle: false }">
    <NfTag value="Global default" />
    <NfTag value="Local override" type="warning" :circle="true" />
  </NfConfigProvider>
</template>
```

### NfTextOverflow {#config-nf-text-overflow}

### NfTextOverflow
```vue
<script setup>
import { NfConfigProvider, NfTextOverflow } from '@94ai-plus/common-ui'
const content = "Global default · Name · ".repeat(30)
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-text-overflow="{ rows: 2, rowHeight: 22 }">
    <NfTextOverflow :content="content" style="max-width: 280px" />
  </NfConfigProvider>
</template>
```

### NfTransferSelect {#config-nf-transfer-select}

### NfTransferSelect
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfTransferSelect } from '@94ai-plus/common-ui'
const value = ref([])
const options = Array.from({ length: 12 }, (_, index) => ({ label: 'Option ' + (index + 1), value: index + 1 }))
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-transfer-select="{ filterable: true, collapseTags: false, titles: ['Available', 'Selected'] }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfTransferSelect v-model="value" :options="options" style="width: 260px; max-width: 100%" />
    </div>
  </NfConfigProvider>
</template>
```

### NfVariableSelect {#config-nf-variable-select}

### NfVariableSelect
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfVariableSelect, NfButton } from '@94ai-plus/common-ui'
const value = ref('')
const data = [{ paramId: 1, name: 'Alpha' }, { paramId: 2, name: 'Beta' }]
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-variable-select="{ size: 'default', width: 240, groupable: false, placeholder: 'Please select' }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfVariableSelect :data="data" @variate-click="row => value = row.name">
        <NfButton>Please select</NfButton>
      </NfVariableSelect>
    </div>
  </NfConfigProvider>
</template>
```

### NfVirtualSelect {#config-nf-virtual-select}

### NfVirtualSelect
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfVirtualSelect } from '@94ai-plus/common-ui'
const value = ref([])
const options = Array.from({ length: 12 }, (_, index) => ({ label: 'Option ' + (index + 1), value: index + 1 }))
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-virtual-select="{ multiple: true, filterable: true, clearable: true, virtualList: true }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfVirtualSelect v-model="value" :options="options" style="width: 260px; max-width: 100%" />
    </div>
  </NfConfigProvider>
</template>
```

### NfHalfYearPicker {#config-nf-half-year-picker}

### NfHalfYearPicker
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfHalfYearPicker } from '@94ai-plus/common-ui'
const value = ref('2026-01-01')
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-half-year-picker="{ clearable: false, size: 'default', valueFormat: 'YYYY-MM-DD' }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfHalfYearPicker v-model="value" />
    </div>
  </NfConfigProvider>
</template>
```

### NfHalfYearRangePicker {#config-nf-half-year-range-picker}

### NfHalfYearRangePicker
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfHalfYearRangePicker } from '@94ai-plus/common-ui'
const value = ref(['2026-01-01', '2026-07-01'])
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-half-year-range-picker="{ clearable: false, size: 'default', valueFormat: 'YYYY-MM-DD' }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfHalfYearRangePicker v-model="value" />
    </div>
  </NfConfigProvider>
</template>
```

### NfWeekRangePicker {#config-nf-week-range-picker}

### NfWeekRangePicker
```vue
<script setup>
import { ref } from 'vue'
import { NfConfigProvider, NfWeekRangePicker } from '@94ai-plus/common-ui'
const value = ref(['2026-01-05', '2026-01-18'])
</script>

<template>
  <NfConfigProvider locale="en-US" :nf-week-range-picker="{ clearable: false, size: 'default', valueFormat: 'YYYY-MM-DD' }">
    <div style="display: flex; flex-direction: column; align-items: flex-start; gap: 16px; width: 100%">
      <pre style="margin: 0; width: 100%">{{ value }}</pre>
      <NfWeekRangePicker v-model="value" />
    </div>
  </NfConfigProvider>
</template>
```

`nfButton`、`nfAction`、`nfAlert`、`nfAudio`、`nfConditions`、`nfConfirm`、`nfDatePicker`、`nfDrawer`、`nfEmpty`、`nfForm`、`nfFormItem`、`nfImportTemplate`、`nfIndicatorPlane`、`nfInfiniteMenu`、`nfKeywords`、`nfLazySelect`、`nfMessage`、`nfNotification`、`nfPopupLazySelect`、`nfRadioGroup`、`nfResizablePanels`、`nfRules`、`nfSearchForm`、`nfSoftphone`、`nfTable`、`nfTag`、`nfTextOverflow`、`nfTransferSelect`、`nfVariableSelect`、`nfVirtualSelect`、`nfHalfYearPicker`、`nfHalfYearRangePicker`、`nfWeekRangePicker`

Half-year, half-year range and week range pickers read their own configuration first, then inherit unset props from `nfDatePicker`.

## Props {#props}

| Prop | Type | Default |
| --- | --- | --- |
| locale | `string \| Element Plus Language` | Inherited context |
| theme | `'chalk' \| 'oem'` | `chalk` |
| element-plus-locale | `object` | - |
| size | `'' \| 'large' \| 'default' \| 'small'` | Inherited context |
| nf-alert, nf-form, nf-table and other component keys | Corresponding props object in `NfComponentConfig` | Inherited per property |
| Other Element Plus props | Same as the installed `ElConfigProvider` | Element Plus defaults |

Default scoped slot: `{ config }`, the merged Element Plus configuration, excluding Nf's `theme` and string `locale`.

## Expanded component examples

### ConfigProviderExample

Source: docs/.vitepress/theme/examples/ConfigProviderDemo.vue

```vue
<script setup lang="ts">
import { ref } from 'vue'
import { NfButton, NfConfigProvider, useLocale, languageDefinitions } from '@94ai-plus/common-ui'

const { english = false } = defineProps<{ english?: boolean }>()
const selectedLocale = ref(useLocale().locale.value)
const theme = ref<'chalk' | 'oem'>(document.documentElement.dataset.nfTheme === 'oem' ? 'oem' : 'chalk')
const count = ref(0)
const { locale, t } = useLocale()
</script>

<template>
  <section class="provider-example">
    <div class="provider-controls">
      <label>
        {{ english ? 'Language' : '语言' }}
        <select v-model="selectedLocale" data-testid="provider-locale">
          <option v-for="(item, name) in languageDefinitions" :key="name" :value="name">{{ item.label }}</option>
        </select>
      </label>
      <label>
        {{ english ? 'Component theme' : '组件主题' }}
        <select v-model="theme" data-testid="provider-theme">
          <option value="chalk">Chalk · #1177ff</option>
          <option value="oem">OEM · #007555</option>
        </select>
      </label>
    </div>

    <NfConfigProvider :locale="selectedLocale" :theme="theme">
      <div class="provider-preview">
        <output data-testid="provider-count">{{ selectedLocale === 'zh-CN' ? '点击次数' : 'Clicks' }}: {{ count }}</output>
        <output data-testid="provider-state">locale: {{ locale }} · theme: {{ theme }}</output>
        <div class="provider-buttons">
          <NfButton type="primary" data-testid="provider-confirm" @click="count++">{{ t('common.confirm') }}</NfButton>
          <NfButton plain data-testid="provider-cancel" @click="count = 0">{{ t('common.cancel') }}</NfButton>
        </div>
        <p data-testid="provider-empty">{{ t('common.empty') }}</p>
      </div>
    </NfConfigProvider>
  </section>
</template>

<style scoped>
.provider-example, .provider-preview { display: grid; gap: 16px; }
.provider-controls, .provider-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.provider-controls label { display: flex; align-items: center; gap: 8px; }
.provider-controls select { box-sizing: border-box; height: 28px; padding: 0 8px; border: 1px solid var(--el-border-color); border-radius: 4px; background: var(--el-bg-color); color: var(--el-text-color-primary); font: inherit; }
.provider-preview { padding: 20px; border: 1px solid var(--nf-color-primary); border-radius: 4px; }
.provider-preview p { margin: 0; }
</style>
```

Source: docs/.vitepress/theme/examples/ElementPlusConfigDemo.vue

```vue
<script setup lang="ts">
import { computed, ref } from 'vue'
import { ElButton, ElInput, ElPagination } from 'element-plus'
import { NfConfigProvider, useLocale, languageDefinitions, elementPlusLocales } from '@94ai-plus/common-ui'

const { english = false } = defineProps<{ english?: boolean }>()
const size = ref<'large' | 'default' | 'small'>('default')
const autoInsertSpace = ref(false)
const selectedLocale = ref(useLocale().locale.value)
const elementLocale = computed(() => elementPlusLocales[selectedLocale.value])
const query = ref('')
const count = ref(0)
</script>

<template>
  <section class="element-config-example">
    <div class="element-config-controls">
      <label>
        {{ english ? 'Global size' : '全局尺寸' }}
        <select v-model="size" data-testid="element-config-size">
          <option value="large">large</option>
          <option value="default">default</option>
          <option value="small">small</option>
        </select>
      </label>
      <label>
        {{ english ? 'Element Plus language' : 'Element Plus 语言' }}
        <select v-model="selectedLocale" data-testid="element-config-locale">
          <option v-for="(item, name) in languageDefinitions" :key="name" :value="name">{{ item.label }}</option>
        </select>
      </label>
      <label><input v-model="autoInsertSpace" data-testid="element-config-space" type="checkbox" /> autoInsertSpace</label>
    </div>

    <NfConfigProvider v-slot="{ config }" :size="size" :locale="elementLocale" :button="{ autoInsertSpace }" :z-index="3000">
      <div class="element-config-preview">
        <output data-testid="element-config-state">size: {{ config?.size }} · zIndex: {{ config?.zIndex }} · clicks: {{ count }}</output>
        <div class="element-config-controls">
          <ElButton type="primary" data-testid="element-config-button" @click="count++">按钮</ElButton>
          <ElButton size="small" data-testid="element-config-override">{{ english ? 'Always small' : '固定 small' }}</ElButton>
        </div>
        <ElInput v-model="query" data-testid="element-config-input" :placeholder="english ? 'Inherits the global size' : '继承全局尺寸'" />
        <ElPagination data-testid="element-config-pagination" layout="total, prev, next" :total="50" />
      </div>
    </NfConfigProvider>
  </section>
</template>

<style scoped>
.element-config-example, .element-config-preview { display: grid; gap: 16px; }
.element-config-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.element-config-controls label { display: flex; align-items: center; gap: 8px; }
.element-config-controls select { box-sizing: border-box; height: 28px; padding: 0 8px; border: 1px solid var(--el-border-color); border-radius: 4px; background: var(--el-bg-color); color: var(--el-text-color-primary); font: inherit; }
.element-config-preview { padding: 16px; border: 1px solid var(--el-border-color); border-radius: 4px; }
</style>
```

Source: docs/.vitepress/theme/examples/NfButtonConfigDemo.vue

```vue
<script setup lang="ts">
import { computed, reactive, ref } from 'vue'
import { Search } from '@element-plus/icons-vue'
import { NfButton, NfConfigProvider, type ButtonProps } from '@94ai-plus/common-ui'

const { english = false } = defineProps<{ english?: boolean }>()
const options = reactive<ButtonProps>({ size: 'medium', type: 'primary', nativeType: 'button' })
const flags = ['round', 'circle', 'plain', 'text', 'disabled', 'loading', 'autofocus'] as const
const icon = ref('legacy')
const settings = computed<ButtonProps>(() => ({ ...options, icon: icon.value === 'component' ? Search : icon.value === 'legacy' ? 'el-icon-search' : '' }))
const clicks = ref(0)
const submits = ref(0)
const resets = ref(0)
</script>

<template>
  <section class="nf-config-example">
    <div class="nf-config-controls">
      <label>size <select v-model="options.size" data-testid="nf-config-size"><option>mini</option><option>small</option><option>medium</option></select></label>
      <label>type <select v-model="options.type" data-testid="nf-config-type"><option :value="undefined">—</option><option>primary</option><option>success</option><option>info</option><option>warning</option><option>danger</option><option>text</option></select></label>
      <label>icon <select v-model="icon" data-testid="nf-config-icon"><option value="">—</option><option value="legacy">el-icon-search</option><option value="component">Search</option></select></label>
      <label>nativeType <select v-model="options.nativeType" data-testid="nf-config-native"><option>button</option><option>submit</option><option>reset</option></select></label>
      <label v-for="flag in flags" :key="flag"><input v-model="options[flag]" :data-testid="`nf-config-${flag}`" type="checkbox" /> {{ flag }}</label>
    </div>
    <output data-testid="nf-config-state">clicks: {{ clicks }} · submits: {{ submits }} · resets: {{ resets }}</output>
    <NfConfigProvider :nf-button="settings">
      <form class="nf-config-preview" @submit.prevent="submits++" @reset="resets++">
        <input aria-label="Form value" name="value" value="initial" data-testid="nf-config-input" />
        <NfButton data-testid="nf-config-inherited" @click="clicks++">{{ english ? 'Inherited' : '继承配置' }}</NfButton>
        <NfButton data-testid="nf-config-local" size="mini" type="success" icon="" :round="false" :circle="false" :plain="false" :text="false" :disabled="false" :loading="false" :autofocus="false" native-type="button" @click="clicks++">{{ english ? 'Local overrides' : '局部覆盖' }}</NfButton>
        <NfConfigProvider :nf-button="{ size: 'small', plain: true }">
          <NfButton data-testid="nf-config-nested">{{ english ? 'Nested: small + plain' : '嵌套：small + plain' }}</NfButton>
        </NfConfigProvider>
      </form>
    </NfConfigProvider>
    <NfButton data-testid="nf-config-outside">{{ english ? 'Outside: mini' : '范围外：mini' }}</NfButton>
  </section>
</template>

<style scoped>
.nf-config-example { display: grid; gap: 16px; }
.nf-config-controls, .nf-config-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.nf-config-controls label { display: flex; align-items: center; gap: 6px; }
.nf-config-controls select, .nf-config-preview input { box-sizing: border-box; height: 28px; max-width: 100%; padding: 0 6px; border: 1px solid var(--el-border-color); border-radius: 4px; background: var(--el-bg-color); color: var(--el-text-color-primary); font: inherit; }
.nf-config-preview { padding: 12px; border: 1px solid var(--el-border-color); border-radius: 4px; }
</style>
```
