Descriptions
具有边框、响应式列、完整行、片段和语义 styles 的详细信息组。
何时使用
页边距和行放置
items 包含 label、children 目和可选 key。内容可以是字符串、数字或 Svelte 片段。 title 和 extra 指定块的标题及其旁边的操作。
| 问题 | 物业 | 示例 |
|---|---|---|
| 无框显示详细信息 | items |
基础领域 |
| 用框架分隔单元格 | bordered |
表格设计 |
| 将标签放在值 | 上方layout="vertical" |
垂直排列 |
| 更改屏幕上的列数 | responsive column |
自适应布局 |
| 占领剩下的队伍 | span="filled" |
宽视野 |
column 指定逻辑列的数量。特定项目的 span 跨越多个列,但仅限于当前行的其余部分。 filled 填充剩余部分;要使该字段填充整行,请将其放置在已完成的行之后。
Layout:horizontal 显示值旁边的标签,vertical 用线分隔它们。bordered 添加边框和标题背景。colon 控制布局使用的冒号。
适应性和尺寸
column 和数字 span 可以接受断点值映射。该选择是通过 matchMedia 通过 viewport 进行的。对于响应式地图,SSR 使用三列后备,然后安装应用实际屏幕。不要期望水合后行数保持不变。
阈值由 ConfigProvider 中的全局 theme.token.screen* 设置,与 Grid 类似。嵌套提供程序继承它们,theme.inherit: false 返回标准值以及其余主题设计令牌(design tokens)。 主题阈值 比较这些区域:相同的 column/span 可以给出具有相同视口宽度的不同布局。更新令牌会替换媒体查询,而无需重新创建第一个单元格及其编辑器。仅具有 mode/primary/紧凑的主题保留标准阈值。
对于 xs,使用 max-width screenXSMax,对于 sm 和以下尺寸 - min-width screenSM、screenMD 等。 screenSMMin 和其余的 min/max 参与顺序检查;它们不会取代底层请求阈值。如果 xs 和 sm 之间留有间隙,则两张卡都不会匹配:列数将恢复为后备 3,并且 span 将单独解析。协调相邻边界;错误的订单已被 SSR 拒绝。调整大小和更改标记会保留输入的文本和实例的状态。
size 支持当前 large/medium/small。不存在的尺寸和明确的介质可以产生不同的几何形状:更改尺寸名称不能被视为视觉 medium 性。检查 size、bordered 和常规 ConfigProvider 的正确组合,如 尺寸示例 中所示。
长值应该换行或具有本地滚动,而不展开整个页面。对于 extra 的操作,请使用可用的按钮或链接。在值中的状态中添加文本,而不仅仅是一种徽章颜色。
语义样式和主题
ConfigProvider.descriptions 指定 class/style 和语义默认值。嵌套记录替换整个父记录。从根本上讲,本地 style 覆盖本地语义层,该语义层位于提供者 style 和提供者语义之后。
styles.label/content 设置所有单元格的样式,items.styles.label/content 定义单个字段。值是 CSS 字符串。描述标记控制颜色、标题背景、填充和标题; 提供商设置 在不改变相邻块的情况下显示优先级。
prefixCls 设置根、标题/title/extra、视图/行、header 和值的完整本地前缀。空字符串和 undefined 选择带有 -descriptions 后缀的 ConfigProvider.prefixCls。语义回调获取原始本地 props.prefixCls; theme.cssVar.prefix 指定一个单独的变量命名空间。 信息前缀 在更改前缀时显示独立的主题范围和 DOM、bind:nativeElement、文本、选择、焦点和 FormData 的保留。
在展开的表行中,特殊的 CSS 规则考虑了公共表前缀和本地描述前缀。 Svelte 使用本地 prefixCls 保存此装饰;在Ant Design 6.6.8参考中,本地前缀被跳过。该示例将 Table 设置为带有 prefixCls:ant 的单独区域,独立于 Descriptions 前缀。表自己的前缀显示在 表格示例 中。
字段由 items 数组传递;标记中不需要单独的 Descriptions.Item。 bind:nativeElement 提供挂载后的根 div。表结构旨在显示,不会自动创建编辑表单。
示例
姓名安娜·诺维科娃 | 角色开发商 | 城市莫斯科 |
邮件anna@example.com | 团队接口 | 项目元件库 |
基础知识
相关字段是只读的;列会调整以适应屏幕的宽度。
<script lang="ts">
import { Descriptions } from '@woodger/antd';
</script>
<Descriptions title={("项目参与者")} items={([
{ key: 'name', label: "姓名", children: "安娜·诺维科娃" },
{ key: 'role', label: "角色", children: "开发商" },
{ key: 'city', label: "城市", children: "莫斯科" },
{ key: 'email', label: "邮件", children: 'anna@example.com' },
{ key: 'team', label: "团队", children: "接口" },
{ key: 'project', label: "项目", children: "元件库" }
])} />
| 姓名 | 项目API | 地位 | 成功地 作品 | 地区 | 欧洲 |
|---|---|---|---|---|---|
| 描述 | 该服务发布接口的数据。 | ||||
带框架桌子
单元格边框和标签背景将字段名称与值分开。
<script lang="ts">
import { Badge, Descriptions } from '@woodger/antd';
</script>
{#snippet status()}<Badge status="success" text={("作品")} />{/snippet}
<Descriptions title={("服务参数")} bordered items={([
{ key: 'name', label: "姓名", children: "项目API" },
{ key: 'status', label: "地位", children: status },
{ key: 'region', label: "地区", children: "欧洲" },
{
key: 'details',
label: "描述",
children: "该服务发布接口的数据。",
span: 'filled'
}
])} />
| 数字 | AD-1042 | 状态 | 准备发货 | 送货 | 导游 |
|---|
方面
切换 large、medium、small 会改变带有边框的表格的缩进。
<script lang="ts">
import { Descriptions, Select } from '@woodger/antd';
let size = $state<'small' | 'medium' | 'large'>('medium');
</script>
<style>.controls { margin-bottom:16px; }</style>
<div
class="controls"
><Select
aria-label={("描述 尺寸")}
bind:value={size}
options={([
{ value: 'large', label: "大的" }, { value: 'medium', label: "普通的" }, {
value: 'small',
label: "小的"
}
])}
/></div>
<Descriptions {size} bordered title={("命令")} items={([
{ key: 'number', label: "数字", children: 'AD-1042' },
{ key: 'state', label: "状态", children: "准备发货" },
{ key: 'delivery', label: "送货", children: "导游" }
])} />
| 周三 | Svelte 5 | 语言 | TypeScript | 集会 | Vite |
|---|---|---|---|---|---|
| 塑料袋 | @woodger/antd | 描述 | 组件通过公共 npm API 连接。 | ||
自适应扬声器
列数:一列用于 xs,两列用于 sm,三列用于 lg。 span=filled 填充该行的其余部分。
<script lang="ts">
import { Descriptions } from '@woodger/antd';
</script>
<Descriptions
id="descriptions-responsive-fields"
title={("项目环境")}
bordered
column={{ xs: 1, sm: 2, lg: 3 }}
items={([
{ key: 'runtime', label: "周三", children: 'Svelte 5' },
{ key: 'language', label: "语言", children: 'TypeScript' },
{ key: 'build', label: "集会", children: 'Vite' },
{ key: 'package', label: "塑料袋", children: '@woodger/antd' },
{
key: 'details',
label: "描述",
children: "组件通过公共 npm API 连接。",
span: 'filled'
}
])}
/>
团队 | 负责任的 | 参加者 |
|---|---|---|
接口 | 安娜·诺维科娃 | 6人 |
项目 | ||
元件库 | ||
竖式签名
在 layout=vertical 中,标签和值占据单独的行。
<script lang="ts">
import { Descriptions } from '@woodger/antd';
</script>
<Descriptions title={("团队")} layout="vertical" items={([
{ key: 'name', label: "团队", children: "接口" },
{ key: 'lead', label: "负责任的", children: "安娜·诺维科娃" },
{ key: 'members', label: "参加者", children: "6人" },
{ key: 'project', label: "项目", children: "元件库", span: 'filled' }
])} />
| 数字 | 作者 | 状态 |
|---|---|---|
| REQ-204 | 安娜·诺维科娃 | 待办的 |
| 评论 | ||
| 检查新组件的可用性。 | ||
带框架立式桌子
垂直排列与 bordered 相结合。
<script lang="ts">
import { Descriptions } from '@woodger/antd';
</script>
<Descriptions title={("出价")} layout="vertical" bordered items={([
{ key: 'number', label: "数字", children: 'REQ-204' },
{ key: 'owner', label: "作者", children: "安娜·诺维科娃" },
{ key: 'state', label: "状态", children: "待办的" },
{
key: 'details',
label: "评论",
children: "检查新组件的可用性。",
span: 'filled'
}
])} />
| 姓名 | Ant Design Svelte | 负责任的 | 安娜·诺维科娃 | 描述 | 地方风格阐明了总体风格。 |
|---|
Semantic DOM
特定元素的常规 styles 和设置提供标签和值。
<script lang="ts">
import { Descriptions } from '@woodger/antd';
</script>
<Descriptions title={("自己设计")} bordered styles={({ props }) => ({
title: 'font-size:18px',
label: `font-weight:${props.bordered ? 600 : 400}`,
content: 'line-height:1.8'
})} items={([
{ key: 'name', label: "姓名", children: 'Ant Design Svelte' },
{
key: 'owner', label: "负责任的", children: "安娜·诺维科娃", styles: {
label: 'color:var(--ant-color-success-text)'
}
},
{
key: 'details',
label: "描述",
children: "地方风格阐明了总体风格。",
span: 'filled'
}
])} />
| 姓名 | 元件库 | ||||
|---|---|---|---|---|---|
| 周三 | Svelte | 语言 | TypeScript | 执照 | MIT |
| 描述 | 用户界面的可重用组件。 | ||||
全线
span=filled 将字段拉伸到整个剩余宽度;其余字段放置在常规列中。
<script lang="ts">
import { Descriptions } from '@woodger/antd';
</script>
<Descriptions title={("项目材料")} bordered items={([
{ key: 'title', label: "姓名", children: "元件库", span: 'filled' },
{ key: 'runtime', label: "周三", children: 'Svelte' },
{ key: 'language', label: "语言", children: 'TypeScript' },
{ key: 'license', label: "执照", children: 'MIT' },
{
key: 'details',
label: "描述",
children: "用户界面的可重用组件。",
span: 'filled'
}
])} />
服务项目API | 状态 成功地 作品 | 模式演示 |
标题中的状态和操作
extra 和字段值接受 Snippet;该按钮更改应用程序的状态。
<script lang="ts">
import { Badge, Button, Descriptions } from '@woodger/antd';
let updating = $state(false);
</script>
{#snippet extra()}
<Button size="small" onclick={() => { updating = !updating; }}>
{("更新")}
</Button>
{/snippet}
{#snippet status()}<Badge status={updating ? 'processing' : 'success'} text={(updating ? "已更新" : "作品")} />{/snippet}
<Descriptions
title={("服务状态")}
extra={(extra)}
items={([
{ key: 'name', label: "服务", children: "项目API" },
{ key: 'status', label: "状态", children: status },
{ key: 'mode', label: "模式", children: "演示" }
])}
/>
语言TypeScript | 周三Svelte 5 | |
整体尺寸和冒号
来自 ConfigProvider 的大小以及通过 colon 明确设计的签名。
<script lang="ts">
import { Checkbox, ConfigProvider, Descriptions } from '@woodger/antd';
let colon = $state(true);
</script>
<style>.controls { margin-bottom:16px; }</style>
<div
class="controls"
><Checkbox
bind:checked={colon}
>{("签名中的冒号")}</Checkbox></div>
<ConfigProvider
componentSize="small"
><Descriptions
title={("常规设置")}
{colon}
items={([
{ key: 'language', label: "语言", children: 'TypeScript' },
{ key: 'runtime', label: "周三", children: 'Svelte 5' }
])}
/></ConfigProvider>
| 项目 | Ant Design Svelte |
|---|---|
| 所有者 | 安娜 |
| 地位 | 暂停 |
项目标准设计 |
设置说明
常规 class/style 和语义默认值、本地单元格样式和嵌套记录重置。
<script lang="ts">
import { Button, Checkbox, ConfigProvider, Descriptions } from '@woodger/antd';
let green = $state(true);
let active = $state(false);
const accent = $derived(green ? '#237804' : '#874d00');
</script>
<style>
.settings { margin-bottom: 24px; }
.examples {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 24px;
}
</style>
<div class="settings">
<Checkbox bind:checked={green}>
{("绿色设置说明")}
</Checkbox>
</div>
<ConfigProvider
descriptions={{
class: 'provider-descriptions',
style: 'border-radius:8px',
classNames: { root: 'context-descriptions-root' },
styles: ({ props }) => ({
root: 'border-radius:4px',
title: `color:${accent}`,
label: props.bordered ? `
background: #f6ffed;
color: #237804;
` : '',
content: `color:${accent}`
})
}}
>
<div class="examples">
<Descriptions title={("常规设置")} bordered column={1}
class="local-descriptions" style="border-radius:16px"
classNames={{ root: 'local-descriptions-root' }}
styles={{
root: 'border-radius:12px',
label: 'font-weight:700',
header: `
flex-wrap: wrap;
gap: 12px;
`
}} extra={(extra)}
items={([
{ key: 'project', label: "项目", children: 'Ant Design Svelte' },
{ key: 'owner', label: "所有者", children: "安娜", styles: { content: 'color:#722ed1' } },
{ key: 'status', label: "地位", children: active ? "积极的" : "暂停" }
])} />
<ConfigProvider descriptions={{}}>
<Descriptions title={("重置后")} column={1}
items={([{
key: 'project',
label: "项目",
children: "标准设计"
}])} />
</ConfigProvider>
</div>
</ConfigProvider>
{#snippet extra()}
<Button onclick={() => { active = !active; }}>
{("更改服务状态")}
</Button>
{/snippet}
地位没有变化 |
项目 | |
|---|---|
| Ant Design Svelte | |
一个本地类用于该主题的不同领域。更改前缀会保留根、单元格和字段;主题变量的命名空间是单独设置的。
Table有一个独立的ant作用域。本地描述前缀保留扩展字符串中的外观。片段中的字段用于检查状态;要编辑表单,请使用 Form.
<script lang="ts">
import { Button, Checkbox, ConfigProvider, Descriptions, Input, Table } from '@woodger/antd';
let custom = $state(true);
let local = $state(true);
let bordered = $state(true);
let vertical = $state(false);
let rtl = $state(false);
let draft = $state(("项目草案"));
let submitted = $state('—');
let nativeElement = $state<HTMLDivElement>();
const prefix = $derived(custom ? 'suite' : 'ant');
</script>
<style>
.example {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 24px;
min-width: 0;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
form {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 16px;
}
section { min-width: 0; }
p { margin: 0; }
output { overflow-wrap: anywhere; }
</style>
{#snippet editor()}
<Input name="draft" bind:value={draft} aria-label={("带前缀的草稿描述")}
style="
width: 100%;
min-width: 0;
" />
{/snippet}
{#snippet details(record: { name: string })}
<Descriptions
prefixCls={local ? 'project-details' : ''}
rootClassName="prefix-descriptions-expanded"
title={("记录数据")}
column={1}
{bordered}
items={([
{ key: 'name', label: "项目", children: record.name },
{ key: 'status', label: "地位", children: "准备发布" }
])}
/>
{/snippet}
<div class="example">
<div class="controls">
<Checkbox bind:checked={custom}>{("通用前缀描述套件")}</Checkbox>
<Checkbox bind:checked={local}>{("本地前缀说明")}</Checkbox>
<Checkbox bind:checked={bordered}>{("带前缀的描述框架")}</Checkbox>
<Checkbox
bind:checked={vertical}
>{("带前缀的垂直描述")}</Checkbox>
<Checkbox bind:checked={rtl}>{("带前缀的 RTL 描述")}</Checkbox>
</div>
<ConfigProvider prefixCls={prefix} direction={rtl ? 'rtl' : 'ltr'}
theme={{
cssVar: { prefix: 'details-theme' },
components: { Descriptions: { titleColor: '#389e0d' } }
}}>
<section aria-label={("带前缀的基本信息")}>
<form onsubmit={event => {
event.preventDefault();
submitted = String(new FormData(event.currentTarget).get('draft') ?? '');
}}>
<Descriptions
bind:nativeElement
prefixCls={local ? 'project-details' : ''}
rootClassName="prefix-descriptions-main"
title={("项目选项")}
column={1}
extra={("主要区域")}
{bordered}
layout={vertical ? 'vertical' : 'horizontal'}
classNames={({ props }) => ({
root: props.prefixCls ? 'details-local-prop' : 'details-provider-prop'
})}
styles={{ header: `
flex-wrap: wrap;
gap: 8px;
` }}
items={([
{ key: 'name', label: "项目", children: 'Ant Design Svelte' },
{ key: 'draft', label: "草稿", children: editor },
{ key: 'status', label: "地位", children: "进行中" }
])}
/>
<div><Button htmlType="submit">{("读取表单数据")}</Button></div>
<output
aria-label={("FormData Descriptions")}
>{("发送: ")}{submitted}</output>
</form>
</section>
</ConfigProvider>
<ConfigProvider prefixCls="neighbor"
theme={{
cssVar: { prefix: 'neighbor-theme' },
components: { Descriptions: { titleColor: '#d48806' } }
}}>
<section aria-label={("带前缀的相邻信息")}>
<Descriptions
prefixCls={local ? 'project-details' : ''}
rootClassName="prefix-descriptions-neighbor"
title={("独立地区")}
column={1}
items={([{ key: 'status', label: "地位", children: "没有变化" }])}
/>
</section>
</ConfigProvider>
<ConfigProvider prefixCls="ant">
<section aria-label={("扩展表行中的说明")}>
<Table
dataSource={([{ key: 'project', name: 'Ant Design Svelte' }])}
columns={([{ key: 'name', title: "项目", dataIndex: 'name' }])}
caption={("表内信息")}
pagination={(false)}
size="small"
expandable={{ expandedRowRender: details, defaultExpandedRowKeys: ['project'] }}
/>
</section>
</ConfigProvider>
<output
aria-label={("前缀说明")}
>{("\n 一般的: ")}{prefix}{(";班级: ")}{(local ? 'project-details' : prefix + '-descriptions')}
</output>
<output aria-label={("根描述")}>{(nativeElement ? "已连接" : "等待挂载")}</output>
<p>
{("一个本地类用于该主题的不同领域。更改前缀会保留根、单元格和字段;主题变量的命名空间是单独设置的。")}
</p>
<p>
{("Table有一个独立的ant作用域。本地描述前缀保留扩展字符串中的外观。片段中的字段用于检查状态;要编辑表单,请使用 Form.")}
</p>
</div>
| 姓名 | Ant Design Svelte | 周三 | Svelte 5 / TypeScript | 地位 | 作品 |
|---|---|---|---|---|---|
| 描述 | 具有主题、RTL 和 SSR 的自托管组件库。 | ||||
服务参数
保存的评论示例:切换框架、垂直布局和响应式列。
<script lang="ts">
import { Descriptions, Tag } from '@woodger/antd';
let bordered = $state(true);
let vertical = $state(false);
</script>
<style>
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
.controls label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
{#snippet status()}<Tag color="success">{("作品")}</Tag>{/snippet}
<div class="controls">
<label><input type="checkbox" bind:checked={bordered} />{(" 框架")}</label>
<label><input type="checkbox" bind:checked={vertical} />{(" 垂直的")}</label>
</div>
<Descriptions
title={("服务参数")}
{bordered}
layout={vertical ? 'vertical' : 'horizontal'}
column={{ xs: 1, sm: 2, lg: 3 }}
items={([
{ key: 'name', label: "姓名", children: 'Ant Design Svelte' },
{ key: 'runtime', label: "周三", children: 'Svelte 5 / TypeScript' },
{ key: 'status', label: "地位", children: status },
{
key: 'description',
label: "描述",
children: "具有主题、RTL 和 SSR 的自托管组件库。",
span: 'filled'
}
])}
/>
列和跨度使用视口的宽度,而不是卡片的宽度。阈值通过 theme.token.screen* 传递,并由嵌套的 ConfigProvider 继承;继承:false返回默认值。 ScreenSMMin 涉及顺序检查,sm 请求本身使用 screenSM。 xs和sm之间可能存在差距:三列有回退,分别选择响应跨度。更改标记会保留第一个单元格的状态和编辑器的 DOM。在挂载之前,SSR 在三列中使用相同的后备。
主题阈值和继承
全局屏幕*标记更改 responsive column/span,而无需重建编辑器。父主题、嵌套继承和 inherit:false 的比较;单独的 screenSMMin 和 screenSM。
Breakpoints.svelte<script lang="ts"> import { Checkbox, ConfigProvider } from '@woodger/antd'; import BreakpointFields from './BreakpointFields.svelte'; let custom = $state(true); let separateMinimum = $state(false); let bordered = $state(true); let vertical = $state(false); const layout = $derived(vertical ? 'vertical' : 'horizontal'); const token = $derived( custom ? { screenXSMax: 639, screenSMMin: 640, screenSM: separateMinimum ? 680 : 640, screenSMMax: 899, screenMDMin: 900, screenMD: separateMinimum ? 920 : 900 } : {} ); </script> <style> .example, .scopes { display: grid; gap: 24px; min-width: 0; } .controls { display: flex; flex-wrap: wrap; gap: 12px; } p { margin: 0; } output { overflow-wrap: anywhere; } </style> <div class="example"> <div class="controls"> <Checkbox bind:checked={custom}>{("自己的阈值 说明")}</Checkbox> <Checkbox bind:checked={separateMinimum} >{("分离 screenSMMin 和 screenSM")}</Checkbox> <Checkbox bind:checked={bordered}>{("框架处于阈值")}</Checkbox> <Checkbox bind:checked={vertical} >{("垂直签名达到阈值")}</Checkbox> </div> <ConfigProvider theme={{ token }}> <div class="scopes"> <BreakpointFields id="custom" title={("家长门槛")} {bordered} {layout} /> <ConfigProvider> <BreakpointFields id="inherited" title={("传统阈值")} {bordered} {layout} /> </ConfigProvider> <ConfigProvider theme={{ inherit: false }}> <BreakpointFields id="reset" title={("重置继承")} {bordered} {layout} /> </ConfigProvider> </div> </ConfigProvider> <output aria-label={("阈值说明")}> {(custom ? `xs ≤ 639px; sm ≥ ${separateMinimum ? 680 : 640}px; md ≥ ${separateMinimum ? 920 : 900}px` : "标准阈值:xs≤575px; sm ≥ 576 像素; MD ≥ 768 像素")} </output> <p> {("列和跨度使用视口的宽度,而不是卡片的宽度。阈值通过 theme.token.screen* 传递,并由嵌套的 ConfigProvider 继承;继承:false返回默认值。 ScreenSMMin 涉及顺序检查,sm 请求本身使用 screenSM。 xs和sm之间可能存在差距:三列有回退,分别选择响应跨度。更改标记会保留第一个单元格的状态和编辑器的 DOM。在挂载之前,SSR 在三列中使用相同的后备。")} </p> </div>BreakpointFields.svelte<script lang="ts"> import { Descriptions, Input, type DescriptionsProps } from '@woodger/antd'; let { id, title, bordered, layout }: { id: string; title: string; bordered: boolean; layout: DescriptionsProps['layout']; } = $props(); let draft = $state(("草稿")); let nativeElement = $state<HTMLDivElement>(); </script> <style> section { display: grid; gap: 12px; min-width: 0; box-sizing: border-box; padding: 16px; border: 1px solid var(--ant-color-border-secondary); border-radius: var(--ant-border-radius-lg); background: var(--ant-color-bg-container); color: var(--ant-color-text); } form { min-width: 0; } </style> {#snippet editor()} <Input aria-label={("" + String((title)) + ": 草稿")} name="draft" bind:value={draft} /> {/snippet} <section aria-label={(title)}> <form aria-label={("" + String((title)) + ": 形式")} onsubmit={event => { event.preventDefault(); }}> <Descriptions id={`descriptions-breakpoints-${id}`} bind:nativeElement title={(title)} {bordered} {layout} column={{ xs: 1, sm: 2, md: 3 }} items={([ { key: 'draft', label: "草稿", children: editor }, { key: 'runtime', label: "周三", children: 'Svelte 5', span: { xs: 1, sm: 1, md: 2 } }, { key: 'language', label: "语言", children: 'TypeScript' }, { key: 'build', label: "集会", children: 'Vite' }, { key: 'package', label: "塑料袋", children: '@woodger/antd', span: 'filled' }, { key: 'mode', label: "模式", children: "开发" }, { key: 'status', label: "地位", children: "准备好" } ])} /> </form> <output aria-label={("" + String((title)) + ": 根")}>{(nativeElement ? "已连接" : "等待挂载")}</output> </section>
API
这些示例是根据当前的 ant.design 页面和已安装包的公共 API 进行检查的。 Props 的完整定义位于 @woodger/antd 中。
| 主题 | 示例或限制 |
|---|---|
| Basic | 相关领域。 |
| border | 框架和服务状态。 |
| Custom size | large, medium, small. |
| responsive | 按断点的列。 |
| Vertical | 在值上方签名。 |
| Vertical border | 带框架的立式桌子。 |
| Custom semantic dom styling | 一般风格和地方 styles。 |
| row | 整行通过 span=filled。 |
| 属性 | 描述 | 类型 | 默认 |
|---|---|---|---|
prefixCls | 根、标题、表格和单元格的完整前缀。空字符串和 undefined 使用提供者前缀;语义回调接收原始的本地属性。 | string | ConfigProvider.prefixCls + "-descriptions" |
items | 带有 label、children 和 span 的字段。 | readonly DescriptionsItem[] | — |
title | 表标题:值或片段。 | DescriptionsContent | — |
extra | 标题中的附加操作。 | DescriptionsContent | — |
column | 具有阈值 theme.token.screen* 的 viewport 列数。令牌是继承的,更新查询时无需重新挂载;在挂载回退之前为 3。 | number | GridResponsive<number> | 自适应 1–4 |
layout | 值旁边的标签或单独的行。 | horizontal | vertical | horizontal |
bordered | 签名的框架和背景。 | boolean | false |
colon | 水平标题中的冒号不带框架。 | boolean | true |
size | large、medium、small;影响缩进。 | ComponentSize | 上下文/大 |
styles | 用于语义槽的 CSS 字符串。 | DescriptionsSlots | callback | — |
classNames | 语义槽的类。 | DescriptionsSlots | callback | — |
nativeElement | bind:nativeElement 而不是 React ref。 | HTMLDivElement | — |
DescriptionsItem
key - 稳定密钥,label - 签名,children - 值。 span 接受数字、filled 或映射断点。styles/classNames 包含 label/content;items styles 指定常规设置。不可变项可以作为只读数组传递。
ConfigProvider.descriptions
DescriptionsConfig: classstyleclassNamesstyles。class/style - 字符串,classNames/styles - 具有当前属性的插槽对象或函数,包括允许的 column、items 和 size。
课程加起来。根样式的优先级:defaults.styles.root → defaults.style → 本地 styles.root → 本地 style。其余插槽的本地样式将覆盖默认值;特定项目的设置指定单元格样式。嵌套描述会替换整个记录,空对象会重置设置。
Semantic DOM
根 div 包含一个带有 title/extra 的标题和一个本机表格。bordered 的签名和值位于单独的 th/td 单元格中。没有边框,每个单元格包含一个标签和一个值;vertical 将它们分成几行。
prefixCls 指定根、header/title/extra、视图/行和所有单元格的类。空的本地属性选择公共提供者前缀。语义回调看到原始的 props.prefixCls,主题变量的命名空间保持独立。当前缀改变时,bind:nativeElement 保持相同的节点。
插槽:root、header、title、extra、label、content。元素可以通过自己的 styles/classNames 来细化其 label/content。描述显示信息;对于编辑,请使用单独的表单,并使用真实的按钮进行 extra 的操作。
注册令牌
theme.components.Descriptions 应用十个组件标记:颜色、边距间距、标题缩进和冒号。风俗 styles 和 style 优先于主题;元素设置细化了整体单元格样式。整体尺寸通过设置 ConfigProvider.componentSize.
| 代币 | 目的 |
|---|---|
colonMarginLeft | 冒号前缩进。 |
colonMarginRight | 冒号后缩进。 |
contentColor | 值的颜色。 |
extraColor | 附加区域颜色。 |
itemPaddingBottom | 无边框行缩进。 |
itemPaddingEnd | 字段之间的间距。 |
labelBg | 框架签名背景。 |
labelColor | 标志色。 |
titleColor | 标题颜色。 |
titleMarginBottom | 底部标题填充。 |
| 代币 | 当前值 |
|---|---|
colorText | rgba(0,0,0,0.88) |
colorTextSecondary | rgba(0,0,0,0.65) |
colorTextHeading | rgba(0,0,0,0.88) |
colorBorderSecondary | #f0f0f0 |
colorFillAlter | rgba(0,0,0,0.02) |
fontSize | 14 |
lineHeight | 1.5714285714285714 |
FAQ
如何将一个字段拉伸到整行?
在完成的行之后指定 span:filled 。在该行的中间,filled 仅占据剩余空间。
为什么安装后布局发生变化?
根据真实视口选择自适应贴图。 SSR使用回退;检查服务器和窄客户端布局。
如何设置自定义字段设计?
使用项目 classNames/styles 作为 label/content。一般语义样式继续设置默认值。
Descriptions.Item 有必要吗?
不会。在 Svelte 中,字段由 items 设置,复杂值由片段设置。