> For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/zh/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/zh/llms-full.txt.

# TaoProvider

配置`@rockshin/tao-ui`

[代码演示](#代码演示)[API](#api)

为组件树提供主题 seed、组件 token、尺寸、密度与禁用状态。

## 何时使用

应用或局部区域需要统一配置 tao-ui 组件时使用 TaoProvider。

**推荐**

- 在应用根部只设置稳定的全局 seed。
- 局部覆盖使用嵌套 Provider。
- Portal 内容应继承同一主题作用域。

**避免**

- 不要在每个组件外重复创建 Provider。

## 代码演示


### 基础用法
```tsx preview
import { Button, Input, Stack, TaoProvider } from '@rockshin/tao-ui';

function TaoProviderExample() {
  return (
    <TaoProvider
      size="large"
      theme={{ token: { colorPrimary: 'oklch(0.42 0.08 210)' } }}
    >
      <Stack direction="horizontal" gap="md" align="center">
        <Button>Inherited button</Button>
        <Input placeholder="Inherited input" />
      </Stack>
    </TaoProvider>
  );
}

export default TaoProviderExample;
```

### 全局尺寸
```tsx preview
import { Button, Input, Stack, TaoProvider } from '@rockshin/tao-ui';

function ProviderSizes() {
  return (
    <Stack gap="lg">
      {(['small', 'medium', 'large'] as const).map((size) => (
        <TaoProvider key={size} size={size}>
          <Stack direction="horizontal" gap="md" align="center">
            <Button>{size} button</Button>
            <Input placeholder={size + ' input'} />
          </Stack>
        </TaoProvider>
      ))}
    </Stack>
  );
}

export default ProviderSizes;
```

### 品牌 Token 与组件 Token
```tsx preview
import { Button, Stack, TaoProvider } from '@rockshin/tao-ui';

function ProviderTokens() {
  return (
    <TaoProvider
      theme={{
        token: {
          colorPrimary: 'oklch(0.42 0.08 210)',
          borderRadius: 8,
        },
        components: {
          Button: {
            fontWeight: 600,
            paddingInline: 20,
          },
        },
      }}
    >
      <Stack direction="horizontal" gap="md">
        <Button>Branded primary</Button>
        <Button variant="secondary">Secondary</Button>
      </Stack>
    </TaoProvider>
  );
}

export default ProviderTokens;
```

### 深色模式、紧凑密度与隔离
```tsx preview
import { Button, Input, Stack, TaoProvider } from '@rockshin/tao-ui';

function ProviderModes() {
  return (
    <Stack gap="lg">
      <TaoProvider theme={{ compact: true }}>
        <Stack direction="horizontal" gap="md">
          <Button>Compact</Button>
          <Input placeholder="Compact input" />
        </Stack>
      </TaoProvider>
      <TaoProvider theme={{ mode: 'dark', inherit: false }}>
        <Stack
          direction="horizontal"
          gap="md"
          style={{ padding: 20, background: 'var(--tao-color-bg-base)' }}
        >
          <Button>Dark mode</Button>
          <Input placeholder="Dark input" />
        </Stack>
      </TaoProvider>
    </Stack>
  );
}

export default ProviderModes;
```

### 全局外观
统一设置表单控件的外观，再按需要局部覆盖。
```tsx preview
import { FormField, Input, Stack, TaoProvider } from '@rockshin/tao-ui';

export default function ProviderGlobalVariant() {
  return (
    <Stack gap="lg">
      <TaoProvider variant="outlined">
        <FormField label="Outlined" style={{ maxWidth: 300 }}>
          <Input placeholder="outlined" />
        </FormField>
      </TaoProvider>
      <TaoProvider variant="filled">
        <FormField label="Filled" style={{ maxWidth: 300 }}>
          <Input placeholder="filled" />
        </FormField>
      </TaoProvider>
      <TaoProvider variant="borderless">
        <FormField label="Borderless" style={{ maxWidth: 300 }}>
          <Input placeholder="borderless" />
        </FormField>
      </TaoProvider>
    </Stack>
  );
}
```

### 品牌色
在同一套组件中切换品牌色，保持状态色与对比关系。
```tsx preview
import {
  Button,
  Checkbox,
  Input,
  Select,
  Stack,
  Switch,
  Tag,
  TaoProvider,
} from '@rockshin/tao-ui';

import { type CSSProperties } from 'react';

const swatchLabel: CSSProperties = {
  fontSize: 12,
  color: 'var(--tao-color-text-tertiary)',
  minWidth: 72,
  fontFamily: 'var(--tao-font-family-code)',
};

function ControlRow({
  label,
  selectOptions = [
    { value: '1', label: 'Option 1' },
    { value: '2', label: 'Option 2' },
  ],
}: {
  label: string;
  selectOptions?: { value: string; label: string }[];
}) {
  return (
    <Stack direction="horizontal" gap="sm" align="center">
      <span style={swatchLabel}>{label}</span>
      <Button variant="primary">Primary</Button>
      <Button variant="secondary">Secondary</Button>
      <Input placeholder="Input" style={{ width: 140 }} />
      <Select options={selectOptions} style={{ width: 140 }} />
      <Switch defaultChecked />
      <Checkbox defaultChecked>Check</Checkbox>
      <Tag color="primary" variant="solid">
        Tag
      </Tag>
    </Stack>
  );
}

const BRAND_PALETTES = [
  { name: 'Default (Anthropic-neutral)', color: 'oklch(0.205 0.01 70)' },
  { name: 'Vercel Black', color: 'oklch(0.145 0 0)' },
  { name: 'Linear Indigo', color: 'oklch(0.52 0.19 275)' },
  { name: 'Stripe Purple', color: 'oklch(0.55 0.22 300)' },
  { name: 'Supabase Green', color: 'oklch(0.62 0.17 155)' },
  { name: 'Notion Orange', color: 'oklch(0.68 0.17 45)' },
];

export default function ProviderBrandColors() {
  return (
    <Stack gap="lg">
      {BRAND_PALETTES.map((p) => (
        <TaoProvider key={p.name} theme={{ token: { colorPrimary: p.color } }}>
          <Stack gap="sm">
            <span style={swatchLabel}>{p.name}</span>
            <ControlRow label={p.color.slice(0, 22)} />
          </Stack>
        </TaoProvider>
      ))}
    </Stack>
  );
}
```

### 语义颜色
分别配置成功、警告、错误等语义颜色，避免复用同一种颜色表达所有状态。
```tsx preview
import {
  Button,
  FormField,
  Input,
  Stack,
  Tag,
  TaoProvider,
} from '@rockshin/tao-ui';

import { type CSSProperties } from 'react';

const swatchLabel: CSSProperties = {
  fontSize: 12,
  color: 'var(--tao-color-text-tertiary)',
  minWidth: 72,
  fontFamily: 'var(--tao-font-family-code)',
};

export default function ProviderSemanticColors() {
  return (
    <TaoProvider
      theme={{
        token: {
          // Nudge from default: greener success, softer warning, oranger error.
          colorSuccess: 'oklch(0.7 0.18 155)',
          colorWarning: 'oklch(0.78 0.16 85)',
          colorError: 'oklch(0.62 0.22 25)',
        },
      }}
    >
      <Stack gap="md">
        <Stack direction="horizontal" gap="sm" align="center">
          <span style={swatchLabel}>success</span>
          <Tag color="success" variant="solid">
            Deployed
          </Tag>
          <Tag color="success" variant="filled">
            Passed
          </Tag>
          <Tag color="success" variant="outlined">
            Ready
          </Tag>
        </Stack>
        <Stack direction="horizontal" gap="sm" align="center">
          <span style={swatchLabel}>warning</span>
          <Tag color="warning" variant="solid">
            Degraded
          </Tag>
          <Tag color="warning" variant="filled">
            Preview
          </Tag>
          <Tag color="warning" variant="outlined">
            Draft
          </Tag>
        </Stack>
        <Stack direction="horizontal" gap="sm" align="center">
          <span style={swatchLabel}>error</span>
          <Tag color="error" variant="solid">
            Failed
          </Tag>
          <Tag color="error" variant="filled">
            Blocked
          </Tag>
          <Tag color="error" variant="outlined">
            Broken
          </Tag>
          <Button variant="destructive">Delete</Button>
        </Stack>
        <FormField
          label="Error input (focus me)"
          description="ring color follows colorError token"
          style={{ maxWidth: 320 }}
        >
          <Input error placeholder="focus to see error ring" />
        </FormField>
      </Stack>
    </TaoProvider>
  );
}
```

### 圆角尺度
根圆角会派生不同尺寸的圆角，比较整组控件的变化。
```tsx preview
import {
  Button,
  Checkbox,
  Input,
  Select,
  Stack,
  Switch,
  Tag,
  TaoProvider,
} from '@rockshin/tao-ui';

import { type CSSProperties } from 'react';

const swatchLabel: CSSProperties = {
  fontSize: 12,
  color: 'var(--tao-color-text-tertiary)',
  minWidth: 72,
  fontFamily: 'var(--tao-font-family-code)',
};

function ControlRow({
  label,
  selectOptions = [
    { value: '1', label: 'Option 1' },
    { value: '2', label: 'Option 2' },
  ],
}: {
  label: string;
  selectOptions?: { value: string; label: string }[];
}) {
  return (
    <Stack direction="horizontal" gap="sm" align="center">
      <span style={swatchLabel}>{label}</span>
      <Button variant="primary">Primary</Button>
      <Button variant="secondary">Secondary</Button>
      <Input placeholder="Input" style={{ width: 140 }} />
      <Select options={selectOptions} style={{ width: 140 }} />
      <Switch defaultChecked />
      <Checkbox defaultChecked>Check</Checkbox>
      <Tag color="primary" variant="solid">
        Tag
      </Tag>
    </Stack>
  );
}

const RADIUS_STEPS = [
  { name: 'sharp', value: 2 },
  { name: 'default (10)', value: 10 },
  { name: 'rounded', value: 16 },
  { name: 'pill-ish', value: 24 },
];

export default function ProviderRadiusScale() {
  return (
    <Stack gap="lg">
      {RADIUS_STEPS.map((r) => (
        <TaoProvider key={r.name} theme={{ token: { borderRadius: r.value } }}>
          <Stack gap="sm">
            <span style={swatchLabel}>
              {r.name} · {r.value}px
            </span>
            <ControlRow label={`r-${r.value}`} />
          </Stack>
        </TaoProvider>
      ))}
    </Stack>
  );
}
```

### 嵌套与隔离
嵌套 Provider 可继承或重置主题，局部配置不会影响外层。
```tsx preview
import {
  Button,
  Checkbox,
  Input,
  Select,
  Stack,
  Switch,
  Tag,
  TaoProvider,
} from '@rockshin/tao-ui';

import { type CSSProperties } from 'react';

const swatchLabel: CSSProperties = {
  fontSize: 12,
  color: 'var(--tao-color-text-tertiary)',
  minWidth: 72,
  fontFamily: 'var(--tao-font-family-code)',
};

function ControlRow({
  label,
  selectOptions = [
    { value: '1', label: 'Option 1' },
    { value: '2', label: 'Option 2' },
  ],
}: {
  label: string;
  selectOptions?: { value: string; label: string }[];
}) {
  return (
    <Stack direction="horizontal" gap="sm" align="center">
      <span style={swatchLabel}>{label}</span>
      <Button variant="primary">Primary</Button>
      <Button variant="secondary">Secondary</Button>
      <Input placeholder="Input" style={{ width: 140 }} />
      <Select options={selectOptions} style={{ width: 140 }} />
      <Switch defaultChecked />
      <Checkbox defaultChecked>Check</Checkbox>
      <Tag color="primary" variant="solid">
        Tag
      </Tag>
    </Stack>
  );
}

export default function ProviderNestedIsolation() {
  return (
    <TaoProvider
      size="large"
      theme={{ token: { colorPrimary: 'oklch(0.55 0.22 300)' } }} // outer: purple + large
    >
      <Stack gap="md">
        <span style={swatchLabel}>outer · purple / large</span>
        <ControlRow label="outer" />

        <div
          style={{
            paddingLeft: 16,
            borderLeft: '2px solid var(--tao-color-border)',
          }}
        >
          <TaoProvider
            theme={{ token: { colorPrimary: 'oklch(0.68 0.17 45)' } }} // inner: orange, size inherited (=large)
          >
            <Stack gap="sm">
              <span style={swatchLabel}>
                inner · orange, size inherited (large)
              </span>
              <ControlRow label="inner" />
            </Stack>
          </TaoProvider>
        </div>

        <div
          style={{
            paddingLeft: 16,
            borderLeft: '2px solid var(--tao-color-border)',
          }}
        >
          <TaoProvider size="small">
            {/* only size, no token override: color stays purple, size collapses to small */}
            <Stack gap="sm">
              <span style={swatchLabel}>
                inner · color inherited (purple), size=small
              </span>
              <ControlRow label="inner" />
            </Stack>
          </TaoProvider>
        </div>
      </Stack>
    </TaoProvider>
  );
}
```

### 弹层主题继承
打开下拉弹层，确认通过 Portal 渲染的内容仍使用所属 Provider 的主题。
```tsx preview
import { FormField, Select, Stack, TaoProvider } from '@rockshin/tao-ui';

import { type CSSProperties } from 'react';

const swatchLabel: CSSProperties = {
  fontSize: 12,
  color: 'var(--tao-color-text-tertiary)',
  minWidth: 72,
  fontFamily: 'var(--tao-font-family-code)',
};

export default function ProviderPortalTheming() {
  return (
    <Stack gap="lg">
      <span style={swatchLabel}>
        Select popup portals to body but still reads the closest TaoProvider —
        both dropdowns below should match their parent primary.
      </span>
      <Stack direction="horizontal" gap="lg" align="start">
        <TaoProvider
          theme={{ token: { colorPrimary: 'oklch(0.52 0.19 275)' } }}
        >
          <FormField label="Linear-indigo scope" style={{ width: 240 }}>
            <Select
              options={[
                { value: 'a', label: 'Alpha' },
                { value: 'b', label: 'Beta' },
                { value: 'c', label: 'Gamma' },
              ]}
            />
          </FormField>
        </TaoProvider>
        <TaoProvider theme={{ token: { colorPrimary: 'oklch(0.68 0.17 45)' } }}>
          <FormField label="Notion-orange scope" style={{ width: 240 }}>
            <Select
              options={[
                { value: 'a', label: 'Alpha' },
                { value: 'b', label: 'Beta' },
                { value: 'c', label: 'Gamma' },
              ]}
            />
          </FormField>
        </TaoProvider>
      </Stack>
    </Stack>
  );
}
```

### 动态切换主题
通过状态切换主题参数，真实控件与弹层即时响应。
```tsx preview
import {
  Button,
  Checkbox,
  Input,
  Select,
  Stack,
  Switch,
  Tag,
  TaoProvider,
} from '@rockshin/tao-ui';

import { type CSSProperties, useState } from 'react';

const swatchLabel: CSSProperties = {
  fontSize: 12,
  color: 'var(--tao-color-text-tertiary)',
  minWidth: 72,
  fontFamily: 'var(--tao-font-family-code)',
};

function ControlRow({
  label,
  selectOptions = [
    { value: '1', label: 'Option 1' },
    { value: '2', label: 'Option 2' },
  ],
}: {
  label: string;
  selectOptions?: { value: string; label: string }[];
}) {
  return (
    <Stack direction="horizontal" gap="sm" align="center">
      <span style={swatchLabel}>{label}</span>
      <Button variant="primary">Primary</Button>
      <Button variant="secondary">Secondary</Button>
      <Input placeholder="Input" style={{ width: 140 }} />
      <Select options={selectOptions} style={{ width: 140 }} />
      <Switch defaultChecked />
      <Checkbox defaultChecked>Check</Checkbox>
      <Tag color="primary" variant="solid">
        Tag
      </Tag>
    </Stack>
  );
}

const BRAND_PALETTES = [
  { name: 'Default (Anthropic-neutral)', color: 'oklch(0.205 0.01 70)' },
  { name: 'Vercel Black', color: 'oklch(0.145 0 0)' },
  { name: 'Linear Indigo', color: 'oklch(0.52 0.19 275)' },
  { name: 'Stripe Purple', color: 'oklch(0.55 0.22 300)' },
  { name: 'Supabase Green', color: 'oklch(0.62 0.17 155)' },
  { name: 'Notion Orange', color: 'oklch(0.68 0.17 45)' },
];

export default function ProviderDynamicSwitching() {
  function Demo() {
    const [idx, setIdx] = useState(0);
    const current = BRAND_PALETTES[idx];
    return (
      <Stack gap="md">
        <Stack direction="horizontal" gap="sm">
          {BRAND_PALETTES.map((p, i) => (
            <Button
              key={p.name}
              variant={i === idx ? 'primary' : 'secondary'}
              onClick={() => setIdx(i)}
            >
              {p.name.split(' ')[0]}
            </Button>
          ))}
        </Stack>
        <TaoProvider theme={{ token: { colorPrimary: current.color } }}>
          <Stack gap="sm">
            <span style={swatchLabel}>active · {current.name}</span>
            <ControlRow label="live" />
          </Stack>
        </TaoProvider>
      </Stack>
    );
  }
  return <Demo />;
}
```

### 布局透明
Provider 不额外改变布局结构，组件仍按父容器的布局规则排列。
```tsx preview
import { Button, Stack, TaoProvider } from '@rockshin/tao-ui';

import { type CSSProperties } from 'react';

const swatchLabel: CSSProperties = {
  fontSize: 12,
  color: 'var(--tao-color-text-tertiary)',
  minWidth: 72,
  fontFamily: 'var(--tao-font-family-code)',
};

export default function ProviderLayoutTransparent() {
  return (
    <Stack gap="lg">
      <span style={swatchLabel}>
        Children of a single TaoProvider must land in separate grid columns. If
        the wrapper collapsed layout, both cards would stack in column 1.
      </span>
      <div
        style={{
          display: 'grid',
          gridTemplateColumns: '200px 1fr',
          gap: 12,
          border: '1px dashed var(--tao-color-border)',
          padding: 12,
          borderRadius: 'var(--tao-radius-md)',
        }}
      >
        <TaoProvider
          theme={{ token: { colorPrimary: 'oklch(0.52 0.19 275)' } }}
        >
          <div
            style={{
              background: 'var(--tao-primary-bg)',
              border: '1px solid var(--tao-primary-border)',
              borderRadius: 'var(--tao-radius-md)',
              padding: 12,
            }}
          >
            <b>Sidebar</b>
            <div
              style={{ fontSize: 12, color: 'var(--tao-color-text-tertiary)' }}
            >
              col 1 · 200px
            </div>
          </div>
          <div
            style={{
              background: 'var(--tao-color-bg-container)',
              border: '1px solid var(--tao-color-border)',
              borderRadius: 'var(--tao-radius-md)',
              padding: 12,
            }}
          >
            <b>Main</b>
            <div
              style={{ fontSize: 12, color: 'var(--tao-color-text-tertiary)' }}
            >
              col 2 · 1fr — buttons below should feel indigo
            </div>
            <Stack direction="horizontal" gap="sm">
              <Button variant="primary">Primary</Button>
              <Button variant="secondary">Secondary</Button>
            </Stack>
          </div>
        </TaoProvider>
      </div>
    </Stack>
  );
}
```

### 组件级 Token
只覆盖目标组件的 Token，其他组件继续使用全局主题。
```tsx preview
import { Button, Stack, TaoProvider } from '@rockshin/tao-ui';

export default function ProviderComponentTokens() {
  return (
    <Stack gap="md">
      <div style={{ fontSize: 12, color: 'var(--tao-color-text-tertiary)' }}>
        theme.components.Button — pill radius + custom padding/font weight
      </div>
      <TaoProvider
        theme={{
          components: {
            Button: { borderRadius: 9999, paddingInline: 24, fontWeight: 500 },
          },
        }}
      >
        <Stack direction="horizontal" gap="sm">
          <Button variant="primary">Pill Primary</Button>
          <Button variant="secondary">Pill Secondary</Button>
        </Stack>
      </TaoProvider>
    </Stack>
  );
}
```

### 紧凑密度
紧凑模式调整间距与控件密度，字体保持主题定义的字号。
```tsx preview
import { Button, Input, Stack, TaoProvider } from '@rockshin/tao-ui';

export default function ProviderCompactDensity() {
  return (
    <Stack gap="md">
      <div style={{ fontSize: 12, color: 'var(--tao-color-text-tertiary)' }}>
        theme.compact: control height 32→28, paddings one notch tighter
      </div>
      <Stack direction="horizontal" gap="lg" align="start">
        <Stack gap="sm">
          <b>Default</b>
          <Input placeholder="Input" />
          <Button variant="primary">Button</Button>
        </Stack>
        <TaoProvider theme={{ compact: true }}>
          <Stack gap="sm">
            <b>Compact</b>
            <Input placeholder="Input" />
            <Button variant="primary">Button</Button>
          </Stack>
        </TaoProvider>
      </Stack>
    </Stack>
  );
}
```

### 从右到左布局
通过 TaoProvider 的 `direction="rtl"` 或外围 HTML 元素的 `dir="rtl"` 设置方向。组件继承局部方向，弹层挂载到 Portal 后仍沿用触发区域的方向。组件显式 `direction` 或嵌套 Provider 可以覆盖继承值；Carousel 使用已有的 `rtl` 属性。语言与方向独立设置，`bottomLeft` 等显式弹层位置仍表示物理左侧。
```tsx preview
import { Select, Stack, TaoProvider } from '@rockshin/tao-ui';

export default function DirectionExample() {
  return (
    <TaoProvider direction="rtl">
      <Stack gap="md">
        <Select defaultValue="ar" options={[{ value: 'ar', label: 'العربية' }, { value: 'en', label: 'English' }]} />
        <Select direction="ltr" defaultValue="en" options={[{ value: 'en', label: 'English override' }]} />
      </Stack>
    </TaoProvider>
  );
}
```

### 17 种语言与地区格式
切换语言可更新组件默认文案、日期与数字格式。日期默认仍使用原有 ISO 格式；此例用 `format="L"` 显式选择地区格式。数字输入回调始终返回规范 ASCII 十进制字符串。调用方提供的业务标签由应用自行翻译。
```tsx preview
import { useState } from 'react';
import dayjs from 'dayjs';
import {
  DatePicker, Empty, InputNumber, Pagination, Select, Stack, Statistic, TaoProvider, Upload,
  enUS, zhCN, zhTW, jaJP, koKR, frFR, deDE, esES, itIT, ptBR, ruRU, arEG, hiIN, trTR, idID, thTH, viVN,
} from '@rockshin/tao-ui';

const languages = [
  { value: 'enUS', label: 'English', locale: enUS },
  { value: 'zhCN', label: '简体中文', locale: zhCN },
  { value: 'zhTW', label: '繁體中文', locale: zhTW },
  { value: 'jaJP', label: '日本語', locale: jaJP },
  { value: 'koKR', label: '한국어', locale: koKR },
  { value: 'frFR', label: 'Français', locale: frFR },
  { value: 'deDE', label: 'Deutsch', locale: deDE },
  { value: 'esES', label: 'Español', locale: esES },
  { value: 'itIT', label: 'Italiano', locale: itIT },
  { value: 'ptBR', label: 'Português (Brasil)', locale: ptBR },
  { value: 'ruRU', label: 'Русский', locale: ruRU },
  { value: 'arEG', label: 'العربية', locale: arEG },
  { value: 'hiIN', label: 'हिन्दी', locale: hiIN },
  { value: 'trTR', label: 'Türkçe', locale: trTR },
  { value: 'idID', label: 'Bahasa Indonesia', locale: idID },
  { value: 'thTH', label: 'ไทย', locale: thTH },
  { value: 'viVN', label: 'Tiếng Việt', locale: viVN },
];

export default function LocaleExample() {
  const [language, setLanguage] = useState('frFR');
  const selected = languages.find((item) => item.value === language)!;
  return (
    <Stack gap="md">
      <Select aria-label="Language" value={language} options={languages} onChange={(value) => setLanguage(String(value))} />
      <TaoProvider locale={selected.locale} direction={language === 'arEG' ? 'rtl' : 'ltr'}>
        <Stack gap="md">
          <DatePicker defaultValue={dayjs('2026-11-12')} format="L" />
          <InputNumber aria-label="Amount" defaultValue="1234567.89" />
          <Statistic value="1234567.89" />
          <Upload />
          <Pagination total={100} defaultCurrent={2} />
          <Empty />
        </Stack>
      </TaoProvider>
    </Stack>
  );
}
```

## API


### [#](#usetaointernalconfig)useTaoInternalConfig



**Internal component access for token propagation through third-party portals.**



| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |



### [#](#usetaodirection)useTaoDirection



**Resolve DOM inheritance at a component's source, before it creates portals.**



| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |



### [#](#usetaotoken)useTaoToken



**antd `theme.useToken` counterpart, zero-runtime edition: returns every
design token as a `var(--tao-*)` reference string, so custom components can
stay visually consistent with tao-ui and still resolve in the browser
against the live theme (dark mode, seed overrides, compact density):



````
const { token } = useTaoToken();
<div style={{ borderRadius: token['--tao-radius-lg'], padding: token['--tao-padding-lg'] }} />
```**

  |属性|说明|类型|默认值|
|:---:|:---:|:---:|:---:|
  
    

  ### TaoPortalScope

  **Re-establishes the theme token scope inside a portal. Floating components
portal their popup to document.body, escaping the `[data-tao-provider]`
element that carries custom token overrides; wrapping the portal content in
this component re-applies those overrides so colors/sizes stay consistent.

With `asChild`, merges the tokens onto the immediate child (via Radix Slot)
instead of adding a wrapper div. Prefer `asChild` inside portals whose Radix
primitive does NOT Presence-gate its Portal (notably `@radix-ui/react-select`
— see `SelectPortal` in `node_modules/@radix-ui/react-select`): the wrapper
div would otherwise render even while the popup is closed, leaving a ghost
`<div data-tao-provider>` in the body for every mounted-but-closed Select.**

  |属性|说明|类型|默认值|
|:---:|:---:|:---:|:---:|
  |style|节点样式|`CSSProperties \| undefined`|`-`|
    

  ### TaoProvider

  
  |属性|说明|类型|默认值|
|:---:|:---:|:---:|:---:|
  |direction|Text and interaction direction. Defaults to the surrounding DOM direction.|`TaoDirection \| undefined`|`-`|
|locale|Component text and regional settings; omitted keys inherit from the parent.|`Partial<TaoLocale> \| undefined`|`-`|
|disabled|是否禁用|`boolean \| undefined`|`-`|
    

  ### BuiltinTaoLocale

  **Complete dictionaries shipped by tao-ui; custom TaoLocale values stay compatible.**

  |属性|说明|类型|默认值|
|:---:|:---:|:---:|:---:|
  
    

  ### TaoLocale

  **Built-in Select and date-picker text. Arrays use calendar order (Monday first).**

  |属性|说明|类型|默认值|
|:---:|:---:|:---:|:---:|
  
    

````
