Resizable
遵循 Brutalist 5px 圆角、2px 黑框与 4px 零模糊阴影规范的多面板可调分栏组件。
Brutalist 风格的可调整分栏组件:外层面板组采用 5px 圆角(rounded-base)、2px 黑色边框、零模糊 4px 4px 硬影与 DM Sans 字体,内嵌分组通过 variant="nested" 保持无重复边框。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<proto-ui-brutalist-resizable-root
id="brutalist-resizable-hero"
class="h-56 w-full max-w-md"
>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">One</span>
</div>
</proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-handle></proto-ui-brutalist-resizable-handle>
<proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-root
id="brutalist-resizable-nested"
class="h-full w-full min-h-0"
>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Two</span>
</div>
</proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-handle></proto-ui-brutalist-resizable-handle>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Three</span>
</div>
</proto-ui-brutalist-resizable-panel>
</proto-ui-brutalist-resizable-root>
</proto-ui-brutalist-resizable-panel>
</proto-ui-brutalist-resizable-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector('#brutalist-resizable-hero');
const nestedRoot = document.querySelector(
'#brutalist-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-brutalist-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
root.querySelector(
':scope > proto-ui-brutalist-resizable-handle'
),
{ index: 0, withHandle: true }
);
nestedRoot
.querySelectorAll(':scope > proto-ui-brutalist-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
nestedRoot.querySelector(
':scope > proto-ui-brutalist-resizable-handle'
),
{ index: 0, withHandle: true }
);
</script>将于 0.3.0-rc.1 及后续版本中提供。可直接从 @proto.ui/prototypes-brutalist/resizable 导入原型并使用目标宿主 Adapter 适配:
import { resizableRoot, resizablePanel, resizableHandle,} from '@proto.ui/prototypes-brutalist/resizable';import { BrutalistResizableRoot, BrutalistResizablePanel, BrutalistResizableHandle,} from '../proto-ui/components/react';
export function Example() { return ( <BrutalistResizableRoot defaultSizes={[50, 50]} className="h-56 w-full max-w-md"> <BrutalistResizablePanel index={0}>One</BrutalistResizablePanel> <BrutalistResizableHandle index={0} withHandle /> <BrutalistResizablePanel index={1}>Two</BrutalistResizablePanel> </BrutalistResizableRoot> );}BrutalistResizableRoot (variant="default" | "nested")├── BrutalistResizablePanel (index: 0)├── BrutalistResizableHandle (index: 0, withHandle?)└── BrutalistResizablePanel (index: 1)- 顶层
Root默认附带rounded-base、2px 黑框与 4px 硬阴影;在面板内部嵌套另一个Root时传入variant="nested",避免双重边框与阴影堆叠。 - 布局包含
N个Panel(index: 0..N-1)与N - 1个Handle(index: 0..N-2),通过--pui-size驱动静态flex-basis。 Handle默认绘制 2px 黑色分隔线并提供方向性拖拽光标;设置withHandle可显示主色带黑框的 Brutalist 抓握徽章。- 支持指针拖动、方向键、
Shift加速、Home/End与Enter折叠;传入sizes进入受控模式并通过sizesChange/sizesCommit响应变更。
将 orientation 设为 "vertical" 构建上下可调分栏。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<proto-ui-brutalist-resizable-root
id="brutalist-resizable-vertical"
class="h-56 w-full max-w-md"
>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Header</span>
</div>
</proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-handle></proto-ui-brutalist-resizable-handle>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Content</span>
</div>
</proto-ui-brutalist-resizable-panel>
</proto-ui-brutalist-resizable-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector(
'#brutalist-resizable-vertical'
);
setElementProps(root, {
orientation: 'vertical',
defaultSizes: [25, 75],
constraints: [{ min: 20 }, { min: 25 }],
});
root
.querySelectorAll('proto-ui-brutalist-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
root.querySelector('proto-ui-brutalist-resizable-handle'),
{ index: 0 }
);
</script>对比带主色黑框抓握徽章的 withHandle 与极简 2px 黑色分隔线。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<div class="flex w-full max-w-md flex-col gap-4">
<proto-ui-brutalist-resizable-root
id="brutalist-resizable-with-handle"
class="h-40 w-full max-w-md"
>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Sidebar</span>
</div>
</proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-handle></proto-ui-brutalist-resizable-handle>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Content</span>
</div>
</proto-ui-brutalist-resizable-panel>
</proto-ui-brutalist-resizable-root>
<proto-ui-brutalist-resizable-root
id="brutalist-resizable-hairline"
class="h-32 w-full max-w-md"
>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Left</span>
</div>
</proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-handle></proto-ui-brutalist-resizable-handle>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Right</span>
</div>
</proto-ui-brutalist-resizable-panel>
</proto-ui-brutalist-resizable-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const withGrip = document.querySelector(
'#brutalist-resizable-with-handle'
);
setElementProps(withGrip, {
defaultSizes: [25, 75],
constraints: [{ min: 15 }, { min: 30 }],
});
withGrip
.querySelectorAll('proto-ui-brutalist-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
withGrip
.querySelectorAll('proto-ui-brutalist-resizable-handle')
.forEach((handle, index) =>
setElementProps(handle, { index, withHandle: true })
);
const hairline = document.querySelector(
'#brutalist-resizable-hairline'
);
setElementProps(hairline, {
defaultSizes: [50, 50],
constraints: [{ min: 20 }, { min: 20 }],
});
hairline
.querySelectorAll('proto-ui-brutalist-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
hairline.querySelector('proto-ui-brutalist-resizable-handle'),
{ index: 0, withHandle: false }
);
</script>从右到左(RTL)
Section titled “从右到左(RTL)”设置 direction="rtl" 镜像排列顺序与键盘方向增减方向。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<proto-ui-brutalist-resizable-root
id="brutalist-resizable-rtl"
class="h-56 w-full max-w-md"
>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">واحد</span>
</div>
</proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-handle></proto-ui-brutalist-resizable-handle>
<proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-root
id="brutalist-resizable-rtl-nested"
class="h-full w-full min-h-0"
>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">اثنان</span>
</div>
</proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-handle></proto-ui-brutalist-resizable-handle>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">ثلاثة</span>
</div>
</proto-ui-brutalist-resizable-panel>
</proto-ui-brutalist-resizable-root>
</proto-ui-brutalist-resizable-panel>
</proto-ui-brutalist-resizable-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector('#brutalist-resizable-rtl');
const nestedRoot = document.querySelector(
'#brutalist-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-brutalist-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
root.querySelector(
':scope > proto-ui-brutalist-resizable-handle'
),
{ index: 0, withHandle: true }
);
nestedRoot
.querySelectorAll(':scope > proto-ui-brutalist-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
setElementProps(
nestedRoot.querySelector(
':scope > proto-ui-brutalist-resizable-handle'
),
{ index: 0, withHandle: true }
);
</script>多面板与折叠
Section titled “多面板与折叠”三栏布局结合 constraints 与可折叠侧边栏,聚焦首个分隔柄并按 Enter 可快速收起或展开。
Web Components React Vue Vue 2
正在加载交互示例… 正文和源码已可阅读,交互控件就绪后会显示在这里。
<proto-ui-brutalist-resizable-root
id="brutalist-resizable-collapsible"
class="h-56 w-full max-w-2xl"
>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Sidebar</span>
</div>
</proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-handle></proto-ui-brutalist-resizable-handle>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Editor</span>
</div>
</proto-ui-brutalist-resizable-panel>
<proto-ui-brutalist-resizable-handle></proto-ui-brutalist-resizable-handle>
<proto-ui-brutalist-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold text-sm">Inspector</span>
</div>
</proto-ui-brutalist-resizable-panel>
</proto-ui-brutalist-resizable-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector(
'#brutalist-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-brutalist-resizable-panel')
.forEach((panel, index) => setElementProps(panel, { index }));
root
.querySelectorAll('proto-ui-brutalist-resizable-handle')
.forEach((handle, index) =>
setElementProps(handle, { index, withHandle: true })
);
</script>| 属性 | 类型 | 默认值 |
|---|---|---|
variant | 'default' 'nested' | 'default' |
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 |
- 暴露状态: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()。