Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

feat(theme): harmonize button and segment-tab density and radius

Josh Corbett6911221cb978
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx
index 75383607e0..20af9a2dd8 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryItemSearch.tsx
@@ -200,7 +200,7 @@ export const GalleryItemSearch = () => {
outline={isDropTargetActive ? '2px solid' : undefined}
outlineColor={isDropTargetActive ? 'accent.solid' : undefined}
position="relative"
- rounded="l2"
+ rounded="control"
w="full"
onDragLeave={handleNativeDragLeave}
onDragOver={handleNativeDragOver}
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/EditorToolbar.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/EditorToolbar.browser.test.tsx
index d3650ec355..44789c20c9 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/EditorToolbar.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/EditorToolbar.browser.test.tsx
@@ -74,15 +74,15 @@ afterEach(async () => {
});
describe('editor toolbar', () => {
- it('keeps every button on the shared 32px toolbar box', async () => {
+ it('keeps every button on one shared square toolbar box', async () => {
// The node-opacity button is hand-rolled rather than a ToolbarButton, so it
// never picked up the primitive's size. That is not a local defect: Toolbar
// is a column Stack, and its default stretch alignment let one `sm` button
- // widen every sibling to 36px while they kept their 32px height, turning
- // the whole strip into rectangles four pixels wider than the canvas one.
+ // widen every sibling while they kept their height, turning the whole
+ // strip into rectangles wider than the canvas one.
await render(1);
- expect(new Set(buttonBoxes())).toEqual(new Set(['32x32']));
+ expect(new Set(buttonBoxes())).toEqual(new Set(['28x28']));
});
it('states node opacity the way the tool buttons state themselves', async () => {
@@ -96,6 +96,6 @@ describe('editor toolbar', () => {
expect(opacity.getAttribute('aria-pressed')).toBe('true');
expect(paintedFill(opacity)).toBe(paintedFill(activeTool));
- expect(new Set(buttonBoxes())).toEqual(new Set(['32x32']));
+ expect(new Set(buttonBoxes())).toEqual(new Set(['28x28']));
});
});
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/editor/EditorToolbar.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/editor/EditorToolbar.tsx
index e1de4c62e6..6136284a99 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/editor/EditorToolbar.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/editor/EditorToolbar.tsx
@@ -93,8 +93,8 @@ export const EditorToolbar = ({
`Popover.Trigger asChild` would clone that component's Tooltip
wrapper instead of the button. Size is load bearing — `Toolbar`
is a column Stack, so it stretches every sibling to the widest
- child, and one `sm` button here squared off the whole strip at
- 36px while the rest stayed 32px tall. */}
+ child, and one `sm` button here once widened the whole strip
+ past the `xs` squares. */}
<IconButton
aria-label="Node opacity"
aria-pressed={nodeOpacity < 1}
diff --git a/invokeai/frontend/webv2/src/platform/ui/InputShell.tsx b/invokeai/frontend/webv2/src/platform/ui/InputShell.tsx
index 2e56de77f1..d82c8a6734 100644
--- a/invokeai/frontend/webv2/src/platform/ui/InputShell.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/InputShell.tsx
@@ -24,7 +24,7 @@ export const InputShell = ({ children, endElement, ref, startElement, ...boxProp
ref={ref}
alignItems="center"
borderColor="border"
- borderRadius="l2"
+ borderRadius="control"
borderWidth="1px"
css={inputShellInteraction}
display="flex"
diff --git a/invokeai/frontend/webv2/src/platform/ui/ResizableTextarea.tsx b/invokeai/frontend/webv2/src/platform/ui/ResizableTextarea.tsx
index a4dd79ba60..ce5a644356 100644
--- a/invokeai/frontend/webv2/src/platform/ui/ResizableTextarea.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/ResizableTextarea.tsx
@@ -138,7 +138,7 @@ export const ResizableTextarea = ({
<Box position="relative">
{underlay}
<ScrollArea.Root
- borderRadius="l2"
+ borderRadius="control"
h={`${displayHeightPx}px`}
size="xs"
variant="hover"
diff --git a/invokeai/frontend/webv2/src/platform/ui/SegmentTabs.tsx b/invokeai/frontend/webv2/src/platform/ui/SegmentTabs.tsx
index 5384f5425a..bee6fbd5a5 100644
--- a/invokeai/frontend/webv2/src/platform/ui/SegmentTabs.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/SegmentTabs.tsx
@@ -151,7 +151,7 @@ const SegmentTabButton = <T extends string>({
overflow="hidden"
px="2.5"
role="tab"
- rounded="md"
+ rounded="control"
tabIndex={isSelected ? 0 : -1}
type="button"
_hover={isShown ? undefined : TAB_HOVER_PROPS}
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
index 0a262ea219..76b8cec876 100644
--- a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
@@ -175,12 +175,19 @@ export const tabsSlotRecipe = defineSlotRecipe({
export const buttonRecipe = defineRecipe({
...chakraRecipes.button,
+ base: {
+ ...chakraRecipes.button.base,
+ borderRadius: 'control',
+ },
variants: {
...chakraRecipes.button.variants,
+ // One notch denser than Chakra's scale: `xs` lands on the segment-tab
+ // pill height, so the controls that share a row share a silhouette.
size: {
...chakraRecipes.button.variants?.size,
- sm: { ...chakraRecipes.button.variants?.size?.sm, textStyle: 'xs' },
- md: { ...chakraRecipes.button.variants?.size?.md, textStyle: 'xs' },
+ xs: { ...chakraRecipes.button.variants?.size?.xs, h: '7', minW: '7' },
+ sm: { ...chakraRecipes.button.variants?.size?.sm, h: '8', minW: '8', textStyle: 'xs' },
+ md: { ...chakraRecipes.button.variants?.size?.md, h: '9', minW: '9', textStyle: 'xs' },
},
variant: {
...chakraRecipes.button.variants?.variant,
@@ -221,7 +228,9 @@ export const segmentGroupSlotRecipe = defineSlotRecipe({
'--segment-indicator-shadow': 'none',
bg: 'transparent',
borderColor: 'border.subtle',
- borderRadius: 'md',
+ // The buttons' shared corner outside, minus the 1px border inside — the
+ // sm segment radius already sits at that inner value.
+ borderRadius: 'control',
borderWidth: '1px',
boxShadow: 'none',
},
@@ -277,14 +286,14 @@ export const segmentGroupSlotRecipe = defineSlotRecipe({
xs: {
item: {
...chakraSlotRecipes.segmentGroup.variants?.size?.xs?.item,
- height: 'calc({sizes.8} - 2px)',
+ height: 'calc({sizes.7} - 2px)',
px: '2.5',
},
},
sm: {
item: {
...chakraSlotRecipes.segmentGroup.variants?.size?.sm?.item,
- height: 'calc({sizes.9} - 2px)',
+ height: 'calc({sizes.8} - 2px)',
px: '3.5',
textStyle: 'xs',
},
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
index ade0553651..6dcd8f552c 100644
--- a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
@@ -315,6 +315,11 @@ const config = defineConfig({
button: { value: 'default' },
switch: { value: 'default' },
},
+ radii: {
+ // The shared corner for interactive controls — buttons and the
+ // segment-tab pills meet between Chakra's l2 (4px) and md (6px).
+ control: { value: '0.3125rem' },
+ },
fonts: {
body: {
value: "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/IterationsField.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/IterationsField.tsx
index 914866cea9..8c887e1c77 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/IterationsField.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/IterationsField.tsx
@@ -7,6 +7,10 @@ import { useTranslation } from 'react-i18next';
import { getBatchCount } from './useInvocationState';
+// Chakra's xs input is one notch taller than the app's xs button; the attached
+// Invoke capsule needs both on the shared 28px box.
+const INPUT_HEIGHT_VARS = { '--input-height': 'sizes.7' };
+
/**
* How many times the current graph runs per Invoke.
*
@@ -46,9 +50,10 @@ export const IterationsField = () => {
<Tooltip content={t('topbar.iterations.tooltip', { count: batchCount })} showArrow>
<NumberInput.Root
allowMouseWheel
+ css={INPUT_HEIGHT_VARS}
flexShrink={0}
min={MIN_BATCH_COUNT}
- rounded="l2"
+ rounded="control"
size="xs"
value={String(batchCount)}
w="14"
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.browser.test.tsx
index 5c3485d734..5c3e7069ed 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.browser.test.tsx
@@ -130,7 +130,7 @@ describe('RoutingControl', () => {
const sourceBounds = sourceIcon!.getBoundingClientRect();
const destinationBounds = destinationIcon!.getBoundingClientRect();
expect(buttonBounds.width).toBe(36);
- expect(buttonBounds.height).toBe(32);
+ expect(buttonBounds.height).toBe(28);
expect(buttonBounds.height).toBe(heightReference!.getBoundingClientRect().height);
expect(destinationBounds.left - sourceBounds.left).toBeGreaterThanOrEqual(8);
expect(destinationBounds.top - sourceBounds.top).toBeGreaterThanOrEqual(8);
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.tsx
index 46de8d816b..9afa8ecc25 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/RoutingControl.tsx
@@ -44,10 +44,10 @@ export const RoutingControl = ({ state }: { state: InvocationState }) => {
[`data-routing-${type}-icon`]: '',
icon: getWidgetById(type === 'source' ? sourceTypeId : invocation.destination)?.manifest.icon,
position: 'absolute',
- top: type === 'source' ? '4px' : undefined,
- left: type === 'source' ? '4px' : undefined,
- bottom: type === 'destination' ? '4px' : undefined,
- right: type === 'destination' ? '4px' : undefined,
+ top: type === 'source' ? '2px' : undefined,
+ left: type === 'source' ? '2px' : undefined,
+ bottom: type === 'destination' ? '2px' : undefined,
+ right: type === 'destination' ? '2px' : undefined,
});
return (
@@ -87,10 +87,10 @@ export const RoutingControl = ({ state }: { state: InvocationState }) => {
borderWidth="1px"
boxSize="3.5"
data-routing-source-icon=""
- left="4px"
+ left="2px"
position="absolute"
rounded="xs"
- top="4px"
+ top="2px"
/>
)}
<WidgetIcon {...getWidgetIconProps('destination')} />