Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(core): restore Toolbar padding contract (#7390)

Ernest54f6606a72f5
diff --git a/.changeset/compact-toolbar-padding-alignment-7zb3.md b/.changeset/compact-toolbar-padding-alignment-7zb3.md
index 9f660c4f40..b0bd8168a2 100644
--- a/.changeset/compact-toolbar-padding-alignment-7zb3.md
+++ b/.changeset/compact-toolbar-padding-alignment-7zb3.md
@@ -2,5 +2,5 @@
'@astryxdesign/core': patch
---
-[fix] Compact Toolbar uses a 4px block inset while preserving container-owned inline alignment; the RichText formatting row opts into the matching 4px edge inset (#6954)
+[fix] Toolbar keeps Section-owned inline alignment and uses an 8px block inset at every size.
@ernestt
diff --git a/packages/core/src/Toolbar/Toolbar.doc.mjs b/packages/core/src/Toolbar/Toolbar.doc.mjs
index 67509f803e..79f9a2e928 100644
--- a/packages/core/src/Toolbar/Toolbar.doc.mjs
+++ b/packages/core/src/Toolbar/Toolbar.doc.mjs
@@ -127,7 +127,7 @@ export const docs = {
name: 'size',
type: "'sm' | 'md' | 'lg'",
description:
- 'Size of the toolbar. Controls block padding and minimum height, and coordinates with Button, TextInput, TabList, and Selector; children inherit this size as their default via SizeContext. Compact (sm) toolbars use a 4px block inset while inline padding remains container-owned for alignment.',
+ 'Size of the toolbar. Controls minimum height and coordinates with Button, TextInput, TabList, and Selector; children inherit this size as their default via SizeContext.',
default: "'md'",
},
{
@@ -190,7 +190,7 @@ export const docsZh = {
startContent: '起始内容(LTR 中靠左对齐)。',
centerContent: '居中内容。切换为 CSS grid(1fr auto 1fr)。',
endContent: '结束内容(LTR 中靠右对齐)。',
- size: '工具栏尺寸。控制块轴内边距和最小高度,子组件通过 SizeContext 继承此尺寸作为默认值。sm 工具栏使用 4px 块轴内边距;行内内边距由容器控制以保持对齐。',
+ size: '工具栏尺寸。控制最小高度,子组件通过 SizeContext 继承此尺寸作为默认值。',
gap: '插槽内项目间距。',
orientation: '键盘导航方向。控制方向键方向。',
variant: '传递给 Section 的视觉变体。',
@@ -241,7 +241,7 @@ export const docsDense = {
startContent: 'Start-aligned content.',
centerContent: 'Centered content; switches to 3-col grid.',
endContent: 'End-aligned content.',
- size: 'Toolbar size; controls block padding + min-height and cascades to children via SizeContext. sm uses a 4px block inset; inline padding remains container-owned.',
+ size: 'Toolbar size; controls min-height + cascades to children via SizeContext.',
gap: 'Gap between slot items.',
orientation: 'Keyboard nav direction.',
variant: 'Visual variant for Section.',
diff --git a/packages/core/src/Toolbar/Toolbar.test.tsx b/packages/core/src/Toolbar/Toolbar.test.tsx
index ec3f4d5a64..56d0aea38d 100644
--- a/packages/core/src/Toolbar/Toolbar.test.tsx
+++ b/packages/core/src/Toolbar/Toolbar.test.tsx
@@ -154,7 +154,7 @@ describe('Toolbar', () => {
});
it.each([
- ['sm', 1],
+ ['sm', 2],
['md', 2],
] as const)(
'uses the %s block inset without overriding container inline padding',
diff --git a/packages/core/src/Toolbar/Toolbar.tsx b/packages/core/src/Toolbar/Toolbar.tsx
index 37b81abcff..5cd21a49f4 100644
--- a/packages/core/src/Toolbar/Toolbar.tsx
+++ b/packages/core/src/Toolbar/Toolbar.tsx
@@ -113,18 +113,18 @@ const dynamicStyles = stylex.create({
});
/**
- * Default block padding per toolbar size. Inline padding stays owned by the
- * surrounding Section/container so nested toolbars preserve the same content
- * line as adjacent body content.
+ * Default block padding per toolbar size. Inline padding comes from the
+ * parent container (Card, Section, LayoutHeader) via the Section's
+ * theme default — the toolbar only controls its vertical tightness.
*/
const defaultBlockPaddingForSize: Record<ElementSize, SpacingStep> = {
- sm: 1,
+ sm: 2,
md: 2,
lg: 2,
};
const blockPaddingVarForSize: Record<ElementSize, string> = {
- sm: spacingVars['--spacing-1'],
+ sm: spacingVars['--spacing-2'],
md: spacingVars['--spacing-2'],
lg: spacingVars['--spacing-2'],
};
@@ -135,7 +135,7 @@ const blockPaddingVarForSize: Record<ElementSize, string> = {
* creating even spacing around edge-compensated items (ghost buttons, tabs).
*/
const edgeCompInsetForSize: Record<ElementSize, string> = {
- sm: `calc(var(--container-padding-inline-start, ${spacingVars['--spacing-4']}) - ${spacingVars['--spacing-1']})`,
+ sm: `calc(var(--container-padding-inline-start, ${spacingVars['--spacing-4']}) - ${spacingVars['--spacing-2']})`,
md: `calc(var(--container-padding-inline-start, ${spacingVars['--spacing-4']}) - ${spacingVars['--spacing-2']})`,
lg: `calc(var(--container-padding-inline-start, ${spacingVars['--spacing-4']}) - ${spacingVars['--spacing-2']})`,
};
@@ -164,11 +164,10 @@ export interface ToolbarProps extends BaseProps<HTMLDivElement> {
*/
label: string;
/**
- * Size of the toolbar. Coordinates block padding and child components through
- * SizeContext. Inline padding remains container-owned so nested toolbars share
- * the surrounding content line.
+ * Size of the toolbar. Coordinates with Button, TextInput, TabList, and Selector —
+ * children inherit this size as their default via SizeContext.
*
- * - `'sm'`: Compact — 4px block inset, fits sm buttons/inputs (28px elements)
+ * - `'sm'`: Compact — fits sm buttons/inputs (28px elements)
* - `'md'`: Standard — fits md buttons/inputs (32px elements)
* - `'lg'`: Spacious — fits lg buttons/inputs (36px elements)
* @default 'md'