Resizable
遵循中性内容面、同心圆角、半透明胶囊抓握柄与无障碍不透明回退的 Liquid Glass 可拖拽分栏组件。
Liquid Glass 风格的可调整分栏组件:内容面板保持中性不堆叠多层玻璃,外层容器使用同心 rounded-2xl 半透明高光表面(嵌套时通过 variant="nested" 去框),分隔柄提供 regular / prominent 胶囊抓握层次,并在减少透明度、高对比度或 material="opaque" 时自动回退为高对比度不透明表面。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<div
class="w-full max-w-lg rounded-2xl bg-gradient-to-br from-sky-500/20 via-indigo-500/15 to-fuchsia-500/20 p-6"
>
<proto-ui-liquid-glass-resizable-root
id="liquid-glass-resizable-hero"
class="h-56 w-full"
>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">One</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-handle></proto-ui-liquid-glass-resizable-handle>
<proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-root
id="liquid-glass-resizable-nested"
class="h-full w-full min-h-0"
>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Two</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-handle></proto-ui-liquid-glass-resizable-handle>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Three</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
</proto-ui-liquid-glass-resizable-root>
</proto-ui-liquid-glass-resizable-panel>
</proto-ui-liquid-glass-resizable-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector(
'#liquid-glass-resizable-hero'
);
const nestedRoot = document.querySelector(
'#liquid-glass-resizable-nested'
);
setElementProps(root, {
defaultSizes: [50, 50],
constraints: [
{ min: 20, max: 75, collapsible: true },
{ min: 25 },
],
});
setElementProps(nestedRoot, {
orientation: 'vertical',
defaultSizes: [25, 75],
constraints: [{ min: 20 }, { min: 25 }],
variant: 'nested',
});
root
.querySelectorAll(
':scope > proto-ui-liquid-glass-resizable-panel'
)
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
root.querySelector(
':scope > proto-ui-liquid-glass-resizable-handle'
),
{ index: 0, withHandle: true }
);
nestedRoot
.querySelectorAll(
':scope > proto-ui-liquid-glass-resizable-panel'
)
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
nestedRoot.querySelector(
':scope > proto-ui-liquid-glass-resizable-handle'
),
{ index: 0, withHandle: true }
);
</script>将于 0.3.0-rc.1 及后续版本中提供。可直接从 @proto.ui/prototypes-liquid-glass/resizable 导入原型并适配到目标宿主:
import { resizableRoot, resizablePanel, resizableHandle,} from '@proto.ui/prototypes-liquid-glass/resizable';import { LiquidGlassResizableRoot, LiquidGlassResizablePanel, LiquidGlassResizableHandle,} from '../proto-ui/components/react';
export function Example() { return ( <div className="w-full max-w-lg rounded-2xl bg-gradient-to-br from-sky-500/20 via-indigo-500/15 to-fuchsia-500/20 p-6"> <LiquidGlassResizableRoot defaultSizes={[50, 50]} className="h-56 w-full"> <LiquidGlassResizablePanel index={0}>One</LiquidGlassResizablePanel> <LiquidGlassResizableHandle index={0} withHandle /> <LiquidGlassResizablePanel index={1}>Two</LiquidGlassResizablePanel> </LiquidGlassResizableRoot> </div> );}LiquidGlassResizableRoot (variant="default" | "nested", material="auto" | "opaque")├── LiquidGlassResizablePanel (index: 0)├── LiquidGlassResizableHandle (index: 0, withHandle?, prominence?, material?)└── LiquidGlassResizablePanel (index: 1)- 层次与同心几何:内容面板保持中性清晰,外层
Root提供rounded-2xl外壳,内嵌Root传入variant="nested"避免多层边框堆叠;启用withHandle后在分隔线居中呈现rounded-full胶囊抓握柄。 - 材质回退与无障碍:默认
material="auto"仅在宿主允许透明且非强制配色时启用半透明层次,否则自动回退为不透明配色;禁用态不使用整块降透明度,确保文本与边界对比度清晰可读。 - 多面板、约束与键盘:支持
sizes/defaultSizes、constraints、指针拖动、方向键、Shift加速、Home/End与Enter折叠,默认无障碍名称为Resize panels。
将 orientation 设为 "vertical" 构建上下可调分栏。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<div
class="w-full max-w-lg rounded-2xl bg-gradient-to-br from-sky-500/20 via-indigo-500/15 to-fuchsia-500/20 p-6"
>
<proto-ui-liquid-glass-resizable-root
id="liquid-glass-resizable-vertical"
class="h-56 w-full"
>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Header</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-handle></proto-ui-liquid-glass-resizable-handle>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Content</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
</proto-ui-liquid-glass-resizable-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector(
'#liquid-glass-resizable-vertical'
);
setElementProps(root, {
orientation: 'vertical',
defaultSizes: [25, 75],
constraints: [{ min: 20 }, { min: 25 }],
});
root
.querySelectorAll('proto-ui-liquid-glass-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
root.querySelector('proto-ui-liquid-glass-resizable-handle'),
{ index: 0 }
);
</script>可见分隔柄与突出层次
Section titled “可见分隔柄与突出层次”上方示例对比 prominence="regular" 与 prominence="prominent" 两种胶囊抓握柄,下方展示默认极简分隔线。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<div
class="w-full max-w-lg rounded-2xl bg-gradient-to-br from-sky-500/20 via-indigo-500/15 to-fuchsia-500/20 p-6"
>
<div class="flex w-full max-w-md flex-col gap-4">
<proto-ui-liquid-glass-resizable-root
id="liquid-glass-resizable-with-handle"
class="h-40 w-full"
>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Sidebar</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-handle></proto-ui-liquid-glass-resizable-handle>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Content</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-handle></proto-ui-liquid-glass-resizable-handle>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Details</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
</proto-ui-liquid-glass-resizable-root>
<proto-ui-liquid-glass-resizable-root
id="liquid-glass-resizable-hairline"
class="h-32 w-full"
>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Left</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-handle></proto-ui-liquid-glass-resizable-handle>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Right</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
</proto-ui-liquid-glass-resizable-root>
</div>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const withGrip = document.querySelector(
'#liquid-glass-resizable-with-handle'
);
setElementProps(withGrip, {
defaultSizes: [25, 50, 25],
constraints: [{ min: 15 }, { min: 30 }, { min: 15 }],
});
withGrip
.querySelectorAll('proto-ui-liquid-glass-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
withGrip
.querySelectorAll('proto-ui-liquid-glass-resizable-handle')
.forEach((handle, index) =>
setElementProps(handle, {
index,
withHandle: true,
prominence: index === 1 ? 'prominent' : 'regular',
})
);
const hairline = document.querySelector(
'#liquid-glass-resizable-hairline'
);
setElementProps(hairline, {
defaultSizes: [50, 50],
constraints: [{ min: 20 }, { min: 20 }],
});
hairline
.querySelectorAll('proto-ui-liquid-glass-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
hairline.querySelector(
'proto-ui-liquid-glass-resizable-handle'
),
{ index: 0, withHandle: false }
);
</script>从右到左(RTL)
Section titled “从右到左(RTL)”设置 direction="rtl" 镜像分栏顺序与键盘水平调整方向。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<div
class="w-full max-w-lg rounded-2xl bg-gradient-to-br from-sky-500/20 via-indigo-500/15 to-fuchsia-500/20 p-6"
>
<proto-ui-liquid-glass-resizable-root
id="liquid-glass-resizable-rtl"
class="h-56 w-full"
>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">واحد</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-handle></proto-ui-liquid-glass-resizable-handle>
<proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-root
id="liquid-glass-resizable-rtl-nested"
class="h-full w-full min-h-0"
>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">اثنان</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-handle></proto-ui-liquid-glass-resizable-handle>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">ثلاثة</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
</proto-ui-liquid-glass-resizable-root>
</proto-ui-liquid-glass-resizable-panel>
</proto-ui-liquid-glass-resizable-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector(
'#liquid-glass-resizable-rtl'
);
const nestedRoot = document.querySelector(
'#liquid-glass-resizable-rtl-nested'
);
setElementProps(root, {
direction: 'rtl',
defaultSizes: [50, 50],
constraints: [{ min: 20 }, { min: 20 }],
});
setElementProps(nestedRoot, {
orientation: 'vertical',
direction: 'rtl',
defaultSizes: [25, 75],
constraints: [{ min: 20 }, { min: 25 }],
variant: 'nested',
});
root
.querySelectorAll(
':scope > proto-ui-liquid-glass-resizable-panel'
)
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
root.querySelector(
':scope > proto-ui-liquid-glass-resizable-handle'
),
{ index: 0, withHandle: true }
);
nestedRoot
.querySelectorAll(
':scope > proto-ui-liquid-glass-resizable-panel'
)
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
nestedRoot.querySelector(
':scope > proto-ui-liquid-glass-resizable-handle'
),
{ index: 0, withHandle: true }
);
</script>多面板与折叠
Section titled “多面板与折叠”三栏布局结合可折叠侧栏与约束区间,聚焦首个分隔柄按 Enter 可快速收起或展开。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<div
class="w-full max-w-2xl rounded-2xl bg-gradient-to-br from-sky-500/20 via-indigo-500/15 to-fuchsia-500/20 p-6"
>
<proto-ui-liquid-glass-resizable-root
id="liquid-glass-resizable-collapsible"
class="h-56 w-full"
>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Sidebar</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-handle></proto-ui-liquid-glass-resizable-handle>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Editor</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
<proto-ui-liquid-glass-resizable-handle></proto-ui-liquid-glass-resizable-handle>
<proto-ui-liquid-glass-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Inspector</span>
</div>
</proto-ui-liquid-glass-resizable-panel>
</proto-ui-liquid-glass-resizable-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector(
'#liquid-glass-resizable-collapsible'
);
setElementProps(root, {
defaultSizes: [25, 50, 25],
constraints: [
{ min: 15, max: 35, collapsible: true },
{ min: 30 },
{ min: 15, max: 35 },
],
});
root
.querySelectorAll('proto-ui-liquid-glass-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
root
.querySelectorAll('proto-ui-liquid-glass-resizable-handle')
.forEach((handle, index) =>
setElementProps(handle, { index, withHandle: true })
);
</script>| 属性 | 类型 | 默认值 |
|---|---|---|
variant | 'default' 'nested' | 'default' |
material | 'auto' 'opaque' | 'auto' |
sizes | readonly number[] | — |
defaultSizes | readonly number[] | — |
constraints | readonly ResizablePanelConstraint[] | [] |
value | number | — |
defaultValue | number | 50 |
min | number | 10 |
max | number | 90 |
step | number | 1 |
collapsible | boolean | false |
disabled | boolean | false |
readOnly | boolean | false |
orientation | 'horizontal' 'vertical' | 'horizontal' |
direction | 'ltr' 'rtl' | 'ltr' |
Panel 与 Handle
Section titled “Panel 与 Handle”| 属性 | 类型 | 默认值 |
|---|---|---|
Panel.index | number | 0 |
Handle.index | number | 0 |
Handle.withHandle | boolean | false |
Handle.prominence | 'regular' 'prominent' | 'regular' |
Handle.material | 'auto' 'opaque' | 'auto' |
- 暴露状态:Root 暴露
value、sizes;Panel 暴露size;Handle 暴露value、focusVisible、disabled。 - 事件与方法:Root 触发
sizesChange/sizesCommit/valueChange/valueCommit,并提供requestResize(index, next, commit?)、requestSizes(next, commit?)、requestValue(next, commit?)与cancelResize()。