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(webv2): add theme preferences and settings dialog

joshistoastb3919f17db32
diff --git a/invokeai/frontend/webv2/src/theme/recipes.ts b/invokeai/frontend/webv2/src/theme/recipes.ts
new file mode 100644
index 0000000000..2a558c643b
--- /dev/null
+++ b/invokeai/frontend/webv2/src/theme/recipes.ts
@@ -0,0 +1,78 @@
+import { defineRecipe, defineSlotRecipe } from '@chakra-ui/react';
+
+/**
+ * Reusable, theme-aware recipes for the workbench design system.
+ *
+ * Recipes reference semantic tokens only, so every variant automatically tracks
+ * the active theme. They are consumed inline with `useRecipe({ recipe })` /
+ * `useSlotRecipe({ recipe })`, which keeps them fully typed without the Chakra
+ * typegen step and lets components share one styling contract instead of
+ * repeating prop soup.
+ */
+
+/** Selectable theme swatch card used by the Settings appearance picker. */
+export const themeCardRecipe = defineSlotRecipe({
+ slots: ['root', 'preview', 'swatch', 'body', 'name', 'description', 'indicator'],
+ base: {
+ root: {
+ alignItems: 'stretch',
+ bg: 'bg.surface',
+ borderColor: 'border.subtle',
+ borderRadius: 'lg',
+ borderWidth: '1px',
+ cursor: 'pointer',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '2.5',
+ overflow: 'hidden',
+ p: '3',
+ textAlign: 'left',
+ transition: 'border-color 0.12s ease, background 0.12s ease, transform 0.12s ease',
+ _hover: { borderColor: 'border.emphasis' },
+ _focusVisible: { outline: '2px solid', outlineColor: 'accent.active', outlineOffset: '2px' },
+ },
+ preview: {
+ borderColor: 'border.subtle',
+ borderRadius: 'md',
+ borderWidth: '1px',
+ display: 'flex',
+ h: '8',
+ overflow: 'hidden',
+ },
+ swatch: { flex: '1' },
+ body: { alignItems: 'flex-start', display: 'flex', flexDirection: 'column', gap: '0.5' },
+ name: { color: 'fg.default', fontSize: 'sm', fontWeight: '600' },
+ description: { color: 'fg.subtle', fontSize: '2xs', lineHeight: '1.3' },
+ indicator: {
+ alignItems: 'center',
+ borderRadius: 'full',
+ color: 'accent.invoke',
+ display: 'flex',
+ h: '4',
+ justifyContent: 'center',
+ opacity: 0,
+ w: '4',
+ },
+ },
+ variants: {
+ selected: {
+ true: {
+ root: { borderColor: 'accent.invoke', bg: 'bg.surfaceRaised' },
+ indicator: { opacity: 1 },
+ },
+ false: {},
+ },
+ },
+ defaultVariants: { selected: false },
+});
+
+/** Compact uppercase field label shared across widget forms and the settings modal. */
+export const fieldLabelRecipe = defineRecipe({
+ base: {
+ color: 'fg.muted',
+ fontSize: '2xs',
+ fontWeight: '600',
+ letterSpacing: '0.02em',
+ textTransform: 'uppercase',
+ },
+});
diff --git a/invokeai/frontend/webv2/src/theme/system.ts b/invokeai/frontend/webv2/src/theme/system.ts
index 8b9c3050a2..aa78ea10df 100644
--- a/invokeai/frontend/webv2/src/theme/system.ts
+++ b/invokeai/frontend/webv2/src/theme/system.ts
@@ -1,29 +1,126 @@
import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react';
+import { DEFAULT_THEME_ID, THEMES, THEMES_BY_ID, type ThemeColors } from './themes';
+
/**
- * Workbench design tokens.
+ * Workbench design system.
+ *
+ * The shell is theme-able across several presets (dark, light, forest, mono,
+ * ultra dark). Rather than hand-author one token set per theme, we derive the
+ * semantic-token layer from the theme registry in `themes.ts`:
+ *
+ * - the default theme (`DEFAULT_THEME_ID`) becomes each token's `base` value;
+ * - every other theme contributes a conditional value keyed on a custom
+ * `[data-theme=<id>]` condition.
+ *
+ * `ThemeController` sets `data-theme` on `<html>`, so flipping themes is a single
+ * attribute change with zero re-render of the React tree. Components reference
+ * only the semantic tokens below — they never know which theme is active.
*
- * The v7 workbench is a dark-only creative surface (Photoshop / Blender / DaVinci
- * feel), so the palette is expressed as concrete tokens and surfaced through
- * semantic tokens with single values. Components reference the semantic tokens
- * (`bg.shell`, `fg.muted`, `accent.invoke`, …) rather than raw hex, which keeps
- * the shell theme-able and removes the brittle hard-coded colors the prototype
- * relied on.
+ * We deliberately override Chakra's own neutral tokens (`bg`, `fg`, `border`, …)
+ * as well as the workbench-specific ones, so built-in components (Dialog, Input,
+ * Switch, Button) follow the active theme without per-component overrides.
*/
+
+const NON_DEFAULT_THEMES = THEMES.filter((theme) => theme.id !== DEFAULT_THEME_ID);
+
+/** `light` -> `themeLight`, `ultradark` -> `themeUltradark`. */
+const conditionName = (id: string): string => `theme${id.charAt(0).toUpperCase()}${id.slice(1)}`;
+
+/** Build a semantic-token value object: default theme as `base`, the rest as conditions. */
+const colorToken = (slot: keyof ThemeColors): { value: Record<string, string> } => {
+ const value: Record<string, string> = { base: THEMES_BY_ID[DEFAULT_THEME_ID].colors[slot] };
+
+ for (const theme of NON_DEFAULT_THEMES) {
+ value[`_${conditionName(theme.id)}`] = theme.colors[slot];
+ }
+
+ return { value };
+};
+
+/**
+ * The semantic-token contract. Workbench tokens (`bg.shell`, `accent.invoke`, …)
+ * are the names components consume; the second group re-points Chakra's built-in
+ * neutral tokens at the same palette so library components stay on-theme.
+ */
+const colorSlotByToken: Record<string, keyof ThemeColors> = {
+ // Workbench surfaces
+ 'bg.shell': 'shell',
+ 'bg.surface': 'surface',
+ 'bg.surfaceRaised': 'surfaceRaised',
+ 'bg.center': 'center',
+ 'bg.canvas': 'canvas',
+ 'bg.panel': 'panel',
+ // Workbench borders
+ 'border.subtle': 'line',
+ 'border.emphasis': 'lineStrong',
+ 'border.panel': 'panelStroke',
+ // Workbench foreground
+ 'fg.default': 'fg',
+ 'fg.muted': 'fgMuted',
+ 'fg.subtle': 'fgSubtle',
+ // Accents
+ 'accent.invoke': 'accent',
+ 'accent.invokeFg': 'accentFg',
+ 'accent.widget': 'accentMuted',
+ 'accent.widgetFg': 'accentMutedFg',
+ 'accent.active': 'active',
+ 'accent.activeFg': 'activeFg',
+ 'canvas.dot': 'dot',
+ // Chakra built-in neutrals, re-pointed at the theme palette
+ bg: 'surface',
+ 'bg.subtle': 'surfaceRaised',
+ 'bg.muted': 'panel',
+ 'bg.emphasized': 'lineStrong',
+ fg: 'fg',
+ border: 'line',
+ 'border.muted': 'line',
+ 'border.emphasized': 'lineStrong',
+ 'fg.error': 'danger',
+ // Chakra's default recipes style controls through colorPalette.* even when
+ // callers don't pass a colorPalette prop. Point that virtual palette at the
+ // active workbench theme so Button/Input/Switch/etc. don't fall back to gray.
+ 'colorPalette.fg': 'fg',
+ 'colorPalette.subtle': 'surfaceRaised',
+ 'colorPalette.muted': 'panel',
+ 'colorPalette.emphasized': 'lineStrong',
+ 'colorPalette.border': 'lineStrong',
+ 'colorPalette.solid': 'accent',
+ 'colorPalette.contrast': 'accentFg',
+ 'colorPalette.focusRing': 'active',
+};
+
+const semanticColors = Object.fromEntries(
+ Object.entries(colorSlotByToken).map(([token, slot]) => [token, colorToken(slot)])
+);
+
+const themeConditions = Object.fromEntries(
+ NON_DEFAULT_THEMES.map((theme) => [conditionName(theme.id), `[data-theme=${theme.id}]`])
+);
+
const config = defineConfig({
+ conditions: themeConditions,
globalCss: {
'html, body, #root': {
height: '100%',
},
body: {
- margin: 0,
- minWidth: '960px',
- minHeight: '720px',
- overflow: 'hidden',
bg: 'bg.shell',
color: 'fg.default',
fontFamily: 'body',
+ margin: 0,
+ minHeight: '720px',
+ minWidth: '960px',
+ overflow: 'hidden',
},
+ // Respect the "reduce motion" preference by neutralizing transitions/animations.
+ '[data-reduce-motion="true"], [data-reduce-motion="true"] *, [data-reduce-motion="true"] *::before, [data-reduce-motion="true"] *::after':
+ {
+ animationDuration: '0.001ms !important',
+ animationIterationCount: '1 !important',
+ scrollBehavior: 'auto !important',
+ transitionDuration: '0.001ms !important',
+ },
},
theme: {
tokens: {
@@ -35,58 +132,15 @@ const config = defineConfig({
value: "Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif",
},
},
- colors: {
- workbench: {
- shell: { value: '#141514' },
- surface: { value: '#161716' },
- surfaceRaised: { value: '#181918' },
- center: { value: '#1a1b1a' },
- canvas: { value: '#1c1d1c' },
- panel: { value: '#282928' },
- panelStroke: { value: '#303330' },
- line: { value: '#2e312d' },
- lineStrong: { value: '#343832' },
- dot: { value: '#343734' },
- fg: { value: '#d7dec7' },
- fgMuted: { value: '#a9afa1' },
- fgSubtle: { value: '#6f756a' },
- },
- lime: {
- accent: { value: '#cbff63' },
- contrast: { value: '#10160b' },
- mutedBg: { value: '#33372a' },
- mutedFg: { value: '#dfff8c' },
- },
- sky: {
- accent: { value: '#59cfff' },
- contrast: { value: '#081218' },
- },
- },
},
semanticTokens: {
- colors: {
- 'bg.shell': { value: '{colors.workbench.shell}' },
- 'bg.surface': { value: '{colors.workbench.surface}' },
- 'bg.surfaceRaised': { value: '{colors.workbench.surfaceRaised}' },
- 'bg.center': { value: '{colors.workbench.center}' },
- 'bg.canvas': { value: '{colors.workbench.canvas}' },
- 'bg.panel': { value: '{colors.workbench.panel}' },
- 'border.subtle': { value: '{colors.workbench.line}' },
- 'border.emphasis': { value: '{colors.workbench.lineStrong}' },
- 'border.panel': { value: '{colors.workbench.panelStroke}' },
- 'fg.default': { value: '{colors.workbench.fg}' },
- 'fg.muted': { value: '{colors.workbench.fgMuted}' },
- 'fg.subtle': { value: '{colors.workbench.fgSubtle}' },
- 'accent.invoke': { value: '{colors.lime.accent}' },
- 'accent.invokeFg': { value: '{colors.lime.contrast}' },
- 'accent.widget': { value: '{colors.lime.mutedBg}' },
- 'accent.widgetFg': { value: '{colors.lime.mutedFg}' },
- 'accent.active': { value: '{colors.sky.accent}' },
- 'accent.activeFg': { value: '{colors.sky.contrast}' },
- 'canvas.dot': { value: '{colors.workbench.dot}' },
- },
+ colors: semanticColors,
},
},
});
export const system = createSystem(defaultConfig, config);
+
+/** Theme metadata re-exported so UI can import a single module. */
+export { THEMES, THEMES_BY_ID, DEFAULT_THEME_ID } from './themes';
+export type { ThemeColors, ThemeDefinition } from './themes';
diff --git a/invokeai/frontend/webv2/src/workbench/ThemeController.tsx b/invokeai/frontend/webv2/src/workbench/ThemeController.tsx
new file mode 100644
index 0000000000..efde0f951b
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/ThemeController.tsx
@@ -0,0 +1,42 @@
+import { useEffect } from 'react';
+
+import { THEMES_BY_ID } from '../theme/system';
+import { useWorkbench } from './WorkbenchContext';
+
+/**
+ * Applies the persisted appearance preferences to the document root.
+ *
+ * Theme switching is intentionally a DOM-attribute flip rather than a React
+ * re-theme: the semantic-token conditions in `theme/system.ts` key off
+ * `<html data-theme>`, so changing the attribute restyles the whole shell with
+ * no component re-render. `data-reduce-motion` is read by the global CSS that
+ * neutralizes transitions. Renders nothing.
+ */
+export const ThemeController = () => {
+ const { state } = useWorkbench();
+ const { reduceMotion, themeId } = state.account.preferences;
+
+ useEffect(() => {
+ const root = document.documentElement;
+ const theme = THEMES_BY_ID[themeId] ?? THEMES_BY_ID.dark;
+
+ root.dataset.theme = theme.id;
+ root.style.colorScheme = theme.colorScheme;
+ // Keep the native color-mode class in sync for unthemed browser chrome
+ // (scrollbars, native pickers) and any Chakra defaults we don't override.
+ root.classList.toggle('dark', theme.colorScheme === 'dark');
+ root.classList.toggle('light', theme.colorScheme === 'light');
+ }, [themeId]);
+
+ useEffect(() => {
+ const root = document.documentElement;
+
+ if (reduceMotion) {
+ root.dataset.reduceMotion = 'true';
+ } else {
+ delete root.dataset.reduceMotion;
+ }
+ }, [reduceMotion]);
+
+ return null;
+};
diff --git a/invokeai/frontend/webv2/src/workbench/components/SettingsDialog.tsx b/invokeai/frontend/webv2/src/workbench/components/SettingsDialog.tsx
new file mode 100644
index 0000000000..9c9ece501f
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/components/SettingsDialog.tsx
@@ -0,0 +1,222 @@
+import {
+ Box,
+ Button,
+ chakra,
+ CloseButton,
+ Dialog,
+ Flex,
+ HStack,
+ Icon,
+ IconButton,
+ Portal,
+ SimpleGrid,
+ Stack,
+ Switch,
+ Text,
+ useSlotRecipe,
+} from '@chakra-ui/react';
+import type { ReactNode } from 'react';
+import { PiArrowCounterClockwiseBold, PiCheckBold, PiGearSixBold, PiTrashBold } from 'react-icons/pi';
+
+import { themeCardRecipe } from '../../theme/recipes';
+import { THEMES, type ThemeDefinition } from '../../theme/system';
+import { localStorageWorkbenchPersistence } from '../persistence';
+import type { WorkbenchThemeId } from '../types';
+import { useWorkbench } from '../WorkbenchContext';
+
+/**
+ * Settings entry point: a self-contained gear button that owns its own dialog
+ * open-state. Kept as one composable unit (rather than threading an `isOpen`
+ * boolean through the TopBar) so the rest of the shell stays unaware of it.
+ */
+export const SettingsButton = () => (
+ <Dialog.Root placement="center" scrollBehavior="inside" size="lg">
+ <Dialog.Trigger asChild>
+ <IconButton aria-label="Settings" color="fg.muted" size="sm" variant="ghost" _hover={{ color: 'fg.default' }}>
+ <PiGearSixBold />
+ </IconButton>
+ </Dialog.Trigger>
+ <SettingsDialogContent />
+ </Dialog.Root>
+);
+
+const SettingsDialogContent = () => (
+ <Portal>
+ <Dialog.Backdrop />
+ <Dialog.Positioner>
+ <Dialog.Content bg="bg.surface" borderColor="border.subtle" borderWidth="1px" color="fg.default">
+ <Dialog.Header borderBottomWidth="1px" borderColor="border.subtle">
+ <Stack gap="0.5">
+ <Dialog.Title fontSize="md" fontWeight="700">
+ Settings
+ </Dialog.Title>
+ <Text color="fg.subtle" fontSize="xs">
+ Appearance and workspace preferences for this browser.
+ </Text>
+ </Stack>
+ </Dialog.Header>
+ <Dialog.Body>
+ <Stack gap="7" py="2">
+ <AppearanceSection />
+ <WorkspaceSection />
+ </Stack>
+ </Dialog.Body>
+ <Dialog.CloseTrigger asChild>
+ <CloseButton color="fg.muted" size="sm" />
+ </Dialog.CloseTrigger>
+ </Dialog.Content>
+ </Dialog.Positioner>
+ </Portal>
+);
+
+const SettingsSection = ({
+ children,
+ description,
+ title,
+}: {
+ children: ReactNode;
+ description: string;
+ title: string;
+}) => (
+ <Stack gap="3">
+ <Stack gap="0.5">
+ <Text color="fg.default" fontSize="sm" fontWeight="600">
+ {title}
+ </Text>
+ <Text color="fg.subtle" fontSize="xs">
+ {description}
+ </Text>
+ </Stack>
+ {children}
+ </Stack>
+);
+
+const AppearanceSection = () => {
+ const { dispatch, state } = useWorkbench();
+ const { reduceMotion, showFocusRegionHighlight, themeId } = state.account.preferences;
+
+ const selectTheme = (nextThemeId: WorkbenchThemeId) => {
+ dispatch({ preferences: { themeId: nextThemeId }, type: 'setPreferences' });
+ };
+
+ return (
+ <SettingsSection description="Choose a theme and tune motion." title="Appearance">
+ <SimpleGrid columns={{ base: 2, md: 3 }} gap="3">
+ {THEMES.map((theme) => (
+ <ThemeCard key={theme.id} selected={theme.id === themeId} theme={theme} onSelect={selectTheme} />
+ ))}
+ </SimpleGrid>
+ <SettingToggle
+ checked={reduceMotion}
+ description="Disable transitions and animations across the workbench."
+ label="Reduce motion"
+ onChange={(checked) => dispatch({ preferences: { reduceMotion: checked }, type: 'setPreferences' })}
+ />
+ <SettingToggle
+ checked={showFocusRegionHighlight}
+ description="Draw a subtle outline around the active workbench region."
+ label="Highlight focused region"
+ onChange={(checked) => dispatch({ preferences: { showFocusRegionHighlight: checked }, type: 'setPreferences' })}
+ />
+ </SettingsSection>
+ );
+};
+
+const ThemeCard = ({
+ onSelect,
+ selected,
+ theme,
+}: {
+ onSelect: (themeId: WorkbenchThemeId) => void;
+ selected: boolean;
+ theme: ThemeDefinition;
+}) => {
+ const recipe = useSlotRecipe({ recipe: themeCardRecipe });
+ const styles = recipe({ selected });
+
+ return (
+ <chakra.button type="button" aria-pressed={selected} css={styles.root} onClick={() => onSelect(theme.id)}>
+ <Flex css={styles.preview}>
+ <Box css={styles.swatch} bg={theme.colors.surface} />
+ <Box css={styles.swatch} bg={theme.colors.panel} />
+ <Box css={styles.swatch} bg={theme.colors.accent} />
+ <Box css={styles.swatch} bg={theme.colors.active} />
+ </Flex>
+ <Box css={styles.body}>
+ <HStack justify="space-between" w="full">
+ <Text css={styles.name}>{theme.label}</Text>
+ <Box css={styles.indicator}>
+ <Icon as={PiCheckBold} boxSize="3" />
+ </Box>
+ </HStack>
+ <Text css={styles.description}>{theme.description}</Text>
+ </Box>
+ </chakra.button>
+ );
+};
+
+const SettingToggle = ({
+ checked,
+ description,
+ label,
+ onChange,
+}: {
+ checked: boolean;
+ description: string;
+ label: string;
+ onChange: (checked: boolean) => void;
+}) => (
+ <Switch.Root
+ alignItems="center"
+ checked={checked}
+ display="flex"
+ justifyContent="space-between"
+ w="full"
+ onCheckedChange={(event) => onChange(event.checked)}
+ >
+ <Stack gap="0.5">
+ <Switch.Label color="fg.default" fontSize="sm" fontWeight="500" m="0">
+ {label}
+ </Switch.Label>
+ <Text color="fg.subtle" fontSize="xs">
+ {description}
+ </Text>
+ </Stack>
+ <Switch.HiddenInput />
+ <Switch.Control _checked={{ bg: 'accent.invoke' }}>
+ <Switch.Thumb />
+ </Switch.Control>
+ </Switch.Root>
+);
+
+const WorkspaceSection = () => {
+ const { dispatch } = useWorkbench();
+
+ const clearSavedData = () => {
+ void localStorageWorkbenchPersistence.clearWorkbench().then(() => {
+ window.location.reload();
+ });
+ };
+
+ return (
+ <SettingsSection description="Reset the layout or clear locally saved projects and preferences." title="Workspace">
+ <HStack gap="2" wrap="wrap">
+ <Button size="sm" variant="outline" onClick={() => dispatch({ type: 'resetActiveLayout' })}>
+ <PiArrowCounterClockwiseBold />
+ Reset layout
+ </Button>
+ <Button
+ borderColor="border.emphasis"
+ color="fg.error"
+ size="sm"
+ variant="outline"
+ _hover={{ bg: 'fg.error', color: 'bg.surface' }}
+ onClick={clearSavedData}
+ >
+ <PiTrashBold />
+ Clear saved data
+ </Button>
+ </HStack>
+ </SettingsSection>
+ );
+};
diff --git a/invokeai/frontend/webv2/src/workbench/components/TopBar.tsx b/invokeai/frontend/webv2/src/workbench/components/TopBar.tsx
index 110e50252c..1c48aaaa11 100644
--- a/invokeai/frontend/webv2/src/workbench/components/TopBar.tsx
+++ b/invokeai/frontend/webv2/src/workbench/components/TopBar.tsx
@@ -1,17 +1,11 @@
-import { Badge, Box, Flex, HStack, Icon, IconButton, Text, VStack } from '@chakra-ui/react';
-import {
- PiCaretDownBold,
- PiCaretUpBold,
- PiCubeBold,
- PiGearSixBold,
- PiListNumbersBold,
- PiUserCircleBold,
- PiXBold,
-} from 'react-icons/pi';
+import { Badge, Box, Flex, HStack, Icon, IconButton, NumberInput, Text } from '@chakra-ui/react';
+import { PiCaretDownBold, PiCubeBold, PiListNumbersBold, PiUserCircleBold, PiXBold } from 'react-icons/pi';
import { InvokeControl } from './InvokeControl';
import { LayoutPresetMenu } from './LayoutPresetMenu';
import { ProjectTabs } from './ProjectTabs';
+import { SettingsButton } from './SettingsDialog';
+import { useWorkbench } from '../WorkbenchContext';
/** Workbench top bar: brand, global Invoke command cluster, project tabs, layout + account controls. */
export const TopBar = () => (
@@ -44,9 +38,7 @@ export const TopBar = () => (
>
<PiCubeBold />
</IconButton>
- <IconButton aria-label="Settings" color="fg.muted" size="sm" variant="ghost" _hover={{ color: 'fg.default' }}>
- <PiGearSixBold />
- </IconButton>
+ <SettingsButton />
</HStack>
<HStack as="button" gap="1.5" color="fg.default" flexShrink={0} px="1">
<Icon as={PiUserCircleBold} boxSize="4" />
@@ -75,32 +67,36 @@ const BrandMark = () => (
</Flex>
);
-/**
- * Batch-count stepper placeholder.
- *
- * The iteration/batch field is wired in a later phase (Generate vertical slice);
- * here it reserves its slot and reads as a real stepper.
- */
-const BatchCountField = () => (
- <HStack
- bg="bg.surface"
- borderWidth="1px"
- borderColor="border.emphasis"
- flexShrink={0}
- gap="1"
- h="7"
- px="2"
- rounded="md"
- >
- <Text fontSize="xs" fontWeight="700">
- 3
- </Text>
- <VStack gap="0" color="fg.subtle">
- <Icon as={PiCaretUpBold} boxSize="2" />
- <Icon as={PiCaretDownBold} boxSize="2" />
- </VStack>
- </HStack>
-);
+const getBatchCount = (values: Record<string, unknown>): number => {
+ const batchCount = values.batchCount;
+
+ return typeof batchCount === 'number' && Number.isFinite(batchCount) ? batchCount : 1;
+};
+
+const BatchCountField = () => {
+ const { activeProject, dispatch } = useWorkbench();
+ const batchCount = getBatchCount(activeProject.widgetStates.generate.values);
+
+ return (
+ <NumberInput.Root
+ allowMouseWheel
+ flexShrink={0}
+ max={64}
+ min={1}
+ size="xs"
+ value={String(batchCount)}
+ w="16"
+ onValueChange={({ valueAsNumber }) => {
+ if (Number.isFinite(valueAsNumber)) {
+ dispatch({ batchCount: valueAsNumber, type: 'setGenerateBatchCount' });
+ }
+ }}
+ >
+ <NumberInput.Control />
+ <NumberInput.Input aria-label="Batch count" />
+ </NumberInput.Root>
+ );
+};
/**
* Queue status + cancel cluster placeholder.
@@ -108,33 +104,41 @@ const BatchCountField = () => (
* Mirrors the spec's queue progress / cancel affordance. Real queue wiring,
* snapshotting, and cancellation arrive with the Invocation Controller phases.
*/
-const QueueCluster = () => (
- <HStack flexShrink={0} gap="1">
- <Badge bg="accent.active" color="accent.activeFg" fontSize="2xs" fontWeight="700" gap="1" h="7" px="2" rounded="md">
- <Icon as={PiListNumbersBold} boxSize="3" />
- 2/3
- </Badge>
- <IconButton
- aria-label="Cancel current batch"
- borderWidth="1px"
- borderColor="border.emphasis"
- color="fg.muted"
- size="xs"
- variant="ghost"
- _hover={{ color: 'fg.default' }}
- >
- <PiXBold />
- </IconButton>
- <IconButton
- aria-label="Queue options"
- borderWidth="1px"
- borderColor="border.emphasis"
- color="fg.muted"
- size="xs"
- variant="ghost"
- _hover={{ color: 'fg.default' }}
- >
- <PiCaretDownBold />
- </IconButton>
- </HStack>
-);
+const QueueCluster = () => {
+ const { activeProject } = useWorkbench();
+ const activeCount = activeProject.queue.items.filter(
+ (item) => item.status === 'pending' || item.status === 'running'
+ ).length;
+ const totalCount = activeProject.queue.items.length;
+
+ return (
+ <HStack flexShrink={0} gap="1">
+ <Badge bg="accent.active" color="accent.activeFg" fontSize="2xs" fontWeight="700" gap="1" h="7" px="2">
+ <Icon as={PiListNumbersBold} boxSize="3" />
+ {activeCount}/{totalCount}
+ </Badge>
+ <IconButton
+ aria-label="Cancel current batch"
+ borderWidth="1px"
+ borderColor="border.emphasis"
+ color="fg.muted"
+ size="xs"
+ variant="ghost"
+ _hover={{ color: 'fg.default' }}
+ >
+ <PiXBold />
+ </IconButton>
+ <IconButton
+ aria-label="Queue options"
+ borderWidth="1px"
+ borderColor="border.emphasis"
+ color="fg.muted"
+ size="xs"
+ variant="ghost"
+ _hover={{ color: 'fg.default' }}
+ >
+ <PiCaretDownBold />
+ </IconButton>
+ </HStack>
+ );
+};
diff --git a/invokeai/frontend/webv2/src/workbench/components/ui/Field.tsx b/invokeai/frontend/webv2/src/workbench/components/ui/Field.tsx
new file mode 100644
index 0000000000..d41735d3c9
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/components/ui/Field.tsx
@@ -0,0 +1,32 @@
+import { Stack, Text, useRecipe, type StackProps } from '@chakra-ui/react';
+import type { ReactNode } from 'react';
+
+import { fieldLabelRecipe } from '../../../theme/recipes';
+
+/**
+ * The shared, theme-aware uppercase field label. Backed by `fieldLabelRecipe` so
+ * every form across the workbench renders an identical label without repeating
+ * the same five style props inline.
+ */
+export const FieldLabel = ({ children }: { children: ReactNode }) => {
+ const recipe = useRecipe({ recipe: fieldLabelRecipe });
+
+ return (
+ <Text as="span" css={recipe()}>
+ {children}
+ </Text>
+ );
+};
+
+export interface FieldProps extends Omit<StackProps, 'title'> {
+ label: string;
+ children: ReactNode;
+}
+
+/** A labelled form field: an uppercase label stacked above its control. */
+export const Field = ({ children, label, ...rest }: FieldProps) => (
+ <Stack flex="1" gap="1.5" minW="0" {...rest}>
+ <FieldLabel>{label}</FieldLabel>
+ {children}
+ </Stack>
+);