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(generate): rework prompt fields

Josh Corbett3d65cd110dd2
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.browser.test.tsx
index 61a2f05436..ffebdd470f 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.browser.test.tsx
@@ -144,14 +144,14 @@ describe('dynamic prompts in the positive prompt field', () => {
await expectRowInteractionStylesToMatch(expected, row, hoverBackgroundColor);
});
- it('stays square while it carries no count, and widens only to fit one', async () => {
- // Passing `px={undefined}` reads as "leave the default", but it is spread
- // over Chakra's own `px: '0'` and clobbers it, so the icon-only button used
- // to sit 8px wider than the square buttons either side of it.
+ it('is a labeled primary at rest, and widens only to carry a count', async () => {
+ // A labeled button rather than a bare icon; the expansion count appears
+ // beside the label once the prompt is dynamic.
await render('a plain cat');
const plain = findButton().getBoundingClientRect();
- expect(plain.width).toBeCloseTo(plain.height, 1);
+ expect(findButton().textContent).toContain('widgets.generate.dynamicButton');
+ expect(findButton().textContent).not.toMatch(/\d/);
await act(() => root?.unmount());
host?.remove();
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx
index 9a502941d3..8e789baa3f 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx
@@ -80,20 +80,21 @@ export const DynamicPromptsButton = ({
>
<Tooltip content={tooltip} ids={popoverIds}>
<Popover.Trigger asChild>
+ {/* A labeled primary rather than a bare icon; the expansion count
+ rides beside the label once the prompt is dynamic. */}
<IconButton
aria-label={t('widgets.generate.dynamicPrompts.showPrompts')}
color={expansion.isError ? 'fg.error' : undefined}
opacity={expansion.isDynamic ? undefined : 0.5}
- // `undefined` is not "leave it alone": Chakra's IconButton spreads
- // incoming props over its own `px: '0'`, so an explicit undefined
- // clobbers it and the size recipe's `px: '2'` padded the icon-only
- // button out to 32x24 beside its 24x24 neighbours.
- px={countLabel ? '1' : '0'}
+ px="1"
size="2xs"
variant="ghost"
- w={countLabel ? 'auto' : undefined}
+ w="auto"
>
<BracesIcon />
+ <Text as="span" fontSize="2xs">
+ {t('widgets.generate.dynamicButton')}
+ </Text>
{countLabel ? (
<Text as="span" css={TABULAR_NUMS} fontSize="2xs">
{countLabel}
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/GeneratePromptFields.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/GeneratePromptFields.tsx
index 0e5dc18ff6..c77c57e7ea 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/GeneratePromptFields.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/GeneratePromptFields.tsx
@@ -3,12 +3,13 @@ import type { DynamicPromptsConfig } from '@features/generation/core/dynamicProm
import type { PromptTemplateSnapshot } from '@features/generation/core/promptTemplates';
import type { GenerateModelConfig, GenerateSettings } from '@features/generation/core/types';
-import { Stack } from '@chakra-ui/react';
+import { HStack, Stack, Tag } from '@chakra-ui/react';
import { getPromptPolicy } from '@features/generation/core/baseGenerationPolicies';
import { sanitizeBatchCount } from '@features/generation/core/batch';
import { flattenPromptTemplateExpansion } from '@features/generation/core/promptTemplates';
import { useGenerationUi } from '@features/generation/ui/GenerationUiContext';
import { useCallback, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
import { NegativePromptField } from './NegativePromptField';
import { PositivePromptField } from './PositivePromptField';
@@ -54,6 +55,7 @@ export const GeneratePromptFields = ({
selectedModel,
settings,
}: GeneratePromptFieldsProps) => {
+ const { t } = useTranslation();
const { generateValues, showPromptSyntaxHighlighting } = useGenerationUi().project;
const promptValues = getPromptValues(generateValues);
const promptPolicy = getPromptPolicy(selectedModel, settings);
@@ -155,6 +157,8 @@ export const GeneratePromptFields = ({
[onCommitImmediate]
);
+ const clearPromptTemplate = useCallback(() => applyPromptTemplate(null), [applyPromptTemplate]);
+
return (
<Stack gap="1" py="2">
<PositivePromptField
@@ -175,6 +179,22 @@ export const GeneratePromptFields = ({
onTemplateViewModeChange={setTemplateViewMode}
onUsePrompt={usePromptHistoryItem}
/>
+ {/* Active prompt machinery surfaces as a dismissible chip instead of
+ hidden state that only shows once its panel is opened. */}
+ {settings.promptTemplate ? (
+ <HStack>
+ <Tag.Root size="sm" variant="surface">
+ <Tag.Label>{settings.promptTemplate.name}</Tag.Label>
+ <Tag.EndElement>
+ <Tag.CloseTrigger
+ aria-label={t('widgets.generate.clearPromptTemplate')}
+ title={t('widgets.generate.clearPromptTemplate')}
+ onClick={clearPromptTemplate}
+ />
+ </Tag.EndElement>
+ </Tag.Root>
+ </HStack>
+ ) : null}
{promptPolicy.negativeVisible ? (
<NegativePromptField
heightPx={promptValues.negativePromptHeightPx}
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx
index 29d239e01c..df3ba13db0 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx
@@ -2,12 +2,13 @@
import type { GenerateLora, GenerateModelConfig } from '@features/generation/core/types';
import type { ChangeEvent, KeyboardEvent } from 'react';
-import { HStack, Switch } from '@chakra-ui/react';
+import { HStack, Text } from '@chakra-ui/react';
import { getPromptTemplateChunks } from '@features/generation/core/promptTemplates';
import { useRegisterGenerateDraftFlusher } from '@features/generation/ui/generateDraftRegistry';
import { useDebouncedDraftValue } from '@features/generation/ui/useDebouncedDraftValue';
-import { Field } from '@platform/ui';
-import { useCallback, useId, useMemo, useRef } from 'react';
+import { Button, Field, IconButton, Tooltip } from '@platform/ui';
+import { PlusIcon, XIcon } from 'lucide-react';
+import { useCallback, useMemo, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { AddPromptTriggerButton, PromptTriggerPopover } from './PositivePromptActions';
@@ -122,11 +123,6 @@ export const NegativePromptField = ({
[autocomplete]
);
- const handleEnabledChange = useCallback(
- (event: { checked: boolean }) => onEnabledChange(event.checked),
- [onEnabledChange]
- );
-
const handleTextareaRef = useCallback((element: HTMLTextAreaElement | null) => {
textareaRef.current = element;
}, []);
@@ -142,33 +138,27 @@ export const NegativePromptField = ({
/** Clicking moves the caret, which may land in — or out of — a trigger. */
const handlePromptClick = useCallback(() => autocomplete.refresh(textareaRef.current), [autocomplete]);
- // The switch shares the Field.Root with the textarea; an explicit id keeps
- // its label bound to its own hidden input instead of the Field's control id.
- const enableSwitchInputId = useId();
const labelEnd = useMemo(
() => (
<HStack gap="0.5">
- {isEnabled ? (
- <AddPromptTriggerButton
- isOpen={triggerPicker.isOpen || isViewingMerged}
- onOpenPromptTriggerPicker={triggerPicker.open}
- />
- ) : null}
- <Switch.Root
- checked={isEnabled}
- ids={{ hiddenInput: enableSwitchInputId, label: `${enableSwitchInputId}-label` }}
- size="sm"
- onCheckedChange={handleEnabledChange}
- >
- <Switch.HiddenInput />
- <Switch.Control _checked={{ bg: 'accent.solid' }}>
- <Switch.Thumb />
- </Switch.Control>
- <Switch.Label srOnly>{t('widgets.generate.enableNegativePrompt')}</Switch.Label>
- </Switch.Root>
+ <AddPromptTriggerButton
+ isOpen={triggerPicker.isOpen || isViewingMerged}
+ onOpenPromptTriggerPicker={triggerPicker.open}
+ />
+ <Tooltip content={t('widgets.generate.negativePromptHide')}>
+ <IconButton
+ aria-label={t('widgets.generate.negativePromptHide')}
+ color="fg.muted"
+ size="2xs"
+ variant="ghost"
+ onClick={() => onEnabledChange(false)}
+ >
+ <XIcon />
+ </IconButton>
+ </Tooltip>
</HStack>
),
- [enableSwitchInputId, handleEnabledChange, isEnabled, isViewingMerged, t, triggerPicker]
+ [isViewingMerged, onEnabledChange, t, triggerPicker]
);
const templateChunks = useMemo(
@@ -177,50 +167,66 @@ export const NegativePromptField = ({
);
const exitViewMode = useCallback(() => onTemplateViewModeChange?.(false), [onTemplateViewModeChange]);
+ // Collapsed, the field is a quiet affordance rather than an empty editor: a
+ // ghost "Negative prompt…" row, carrying a truncated preview when disabled text exists
+ // so switched-off terms stay discoverable. Presence reads as enablement while
+ // `negativePromptEnabled` persists unchanged underneath.
+ if (!isEnabled) {
+ return (
+ <Button
+ aria-label={t('widgets.generate.enableNegativePrompt')}
+ color="fg.muted"
+ justifyContent="flex-start"
+ size="2xs"
+ variant="ghost"
+ onClick={() => onEnabledChange(true)}
+ >
+ <PlusIcon />
+ {t('widgets.generate.negativePromptAdd')}
+ {value.trim() !== '' ? (
+ <Text as="span" color="fg.subtle" fontSize="2xs" fontWeight="normal" minW="0" truncate>
+ {value}
+ </Text>
+ ) : null}
+ </Button>
+ );
+ }
+
return (
- <Field
- hint="negativePrompt"
- label={t('widgets.generate.negativePrompt')}
- labelEnd={labelEnd}
- helpText={isEnabled ? helpText : undefined}
- >
- {isEnabled ? (
- <>
- <PromptTextarea
- {...PROMPT_ATTENTION_TARGET_PROPS}
- {...autocomplete.comboboxProps}
- aria-label={t('widgets.generate.negativePrompt')}
- defaultHeightPx={heightPx}
- minHeightPx={56}
- resizeHandleAriaLabel={t('widgets.generate.resizeNegativePrompt')}
- size="xs"
- fontFamily="mono"
- readOnly={isViewingMerged}
- showSyntaxHighlighting={showSyntaxHighlighting}
- templateChunks={templateChunks}
- textareaRef={handleTextareaRef}
- title={isViewingMerged ? t('widgets.generate.promptTemplates.editAuthored') : undefined}
- value={templateChunks ? templateChunks.join('') : draftValue}
- onBlur={autocomplete.close}
- onChange={handlePromptChange}
- onClick={isViewingMerged ? exitViewMode : handlePromptClick}
- onKeyDown={handlePromptKeyDown}
- onResizeEnd={onResizeEnd}
- />
- {autocomplete.element}
- {triggerPicker.dismissElement}
- {triggerPicker.isOpen ? (
- <PromptTriggerPopover
- allowedKinds={NEGATIVE_PROMPT_TRIGGER_KINDS}
- loras={loras}
- open
- positioning={triggerPicker.positioning}
- selectedModel={selectedModel}
- onClose={triggerPicker.close}
- onSelect={triggerPicker.select}
- />
- ) : null}
- </>
+ <Field hint="negativePrompt" label={t('widgets.generate.negativePrompt')} labelEnd={labelEnd} helpText={helpText}>
+ <PromptTextarea
+ {...PROMPT_ATTENTION_TARGET_PROPS}
+ {...autocomplete.comboboxProps}
+ aria-label={t('widgets.generate.negativePrompt')}
+ defaultHeightPx={heightPx}
+ minHeightPx={56}
+ resizeHandleAriaLabel={t('widgets.generate.resizeNegativePrompt')}
+ size="xs"
+ fontFamily="mono"
+ readOnly={isViewingMerged}
+ showSyntaxHighlighting={showSyntaxHighlighting}
+ templateChunks={templateChunks}
+ textareaRef={handleTextareaRef}
+ title={isViewingMerged ? t('widgets.generate.promptTemplates.editAuthored') : undefined}
+ value={templateChunks ? templateChunks.join('') : draftValue}
+ onBlur={autocomplete.close}
+ onChange={handlePromptChange}
+ onClick={isViewingMerged ? exitViewMode : handlePromptClick}
+ onKeyDown={handlePromptKeyDown}
+ onResizeEnd={onResizeEnd}
+ />
+ {autocomplete.element}
+ {triggerPicker.dismissElement}
+ {triggerPicker.isOpen ? (
+ <PromptTriggerPopover
+ allowedKinds={NEGATIVE_PROMPT_TRIGGER_KINDS}
+ loras={loras}
+ open
+ positioning={triggerPicker.positioning}
+ selectedModel={selectedModel}
+ onClose={triggerPicker.close}
+ onSelect={triggerPicker.select}
+ />
) : null}
</Field>
);
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.browser.test.tsx
index 7b4d1c3a5c..f82a850a08 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.browser.test.tsx
@@ -73,7 +73,6 @@ describe('PromptTriggerPopover', () => {
});
});
- const region = document.querySelector<HTMLElement>('[aria-label="Prompt trigger options"]');
const message = [...document.querySelectorAll<HTMLElement>('p')].find(
(element) => element.textContent === 'No prompt triggers available'
);
@@ -81,17 +80,19 @@ describe('PromptTriggerPopover', () => {
(element) => element.textContent === 'Open model manager'
);
- if (!region || !message || !action) {
+ if (!message || !action) {
throw new Error('prompt-trigger empty state did not render');
}
- const regionBounds = region.getBoundingClientRect();
+ // With nothing to search or scroll, the popover hugs its empty state: no
+ // disabled search input, no fixed-height list region holding space open.
+ expect(document.querySelector('[aria-label="Prompt trigger options"]')).toBeNull();
+ expect(document.querySelector('input')).toBeNull();
+
const messageBounds = message.getBoundingClientRect();
const actionBounds = action.getBoundingClientRect();
- const contentCenter = (messageBounds.top + actionBounds.bottom) / 2;
expect(Math.abs(messageBounds.left - actionBounds.left)).toBeLessThanOrEqual(1);
expect(actionBounds.top - messageBounds.bottom).toBeLessThanOrEqual(8);
- expect(contentCenter).toBeCloseTo(regionBounds.top + regionBounds.height / 2, -1);
});
});
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx
index 0909225f98..56bb90b04a 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx
@@ -43,7 +43,6 @@ import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next';
const POPOVER_POSITIONING_BOTTOM_END = { placement: 'bottom-end' } as const;
-const PROMPT_TRIGGER_EMPTY_SCROLL_CONTENT_PROPS = { h: 'full' } as const;
const TEXT_LLM_MODEL_TYPES = ['text_llm'];
const LLAVA_MODEL_TYPES = ['llava_onevision'];
/**
@@ -289,46 +288,44 @@ export const PromptTriggerPopover = ({
<Popover.Positioner>
<Popover.Content bg="bg.muted" borderColor="border.emphasized" borderWidth="1px" w="22rem">
<Popover.Body p="2.5">
- <Stack gap="2" h="18rem">
- <Input
- aria-label={t('widgets.generate.searchPromptTriggers')}
- disabled={options.length === 0}
- placeholder={t('widgets.generate.searchPromptTriggers')}
- size="xs"
- value={searchTerm}
- onChange={handleSearchChange}
- />
- <Separator />
- <Scrollable
- contentProps={options.length === 0 ? PROMPT_TRIGGER_EMPTY_SCROLL_CONTENT_PROPS : undefined}
- flex="1"
- label={t('widgets.generate.promptTriggerOptions')}
- minH="0"
- >
- {options.length === 0 ? (
- <PromptTriggerEmptyState />
- ) : filteredOptions.length === 0 ? (
- <PromptHistoryEmptyText>{t('widgets.generate.noMatchingTriggers')}</PromptHistoryEmptyText>
- ) : (
- <Stack gap="2">
- {groupedOptions.map((group) => (
- <Stack key={group.group} gap="0">
- <Text color="fg.subtle" fontSize="2xs" fontWeight="700" px="2" textTransform="uppercase">
- {group.group}
- </Text>
- {group.options.map((option, index) => (
- <PromptTriggerOptionButton
- key={`${option.group}-${option.value}-${index}`}
- onSelect={onSelect}
- option={option}
- />
- ))}
- </Stack>
- ))}
- </Stack>
- )}
- </Scrollable>
- </Stack>
+ {/* With nothing to search or scroll, the popover hugs its empty
+ state instead of holding the full list height open. */}
+ {options.length === 0 ? (
+ <PromptTriggerEmptyState />
+ ) : (
+ <Stack gap="2" maxH="18rem">
+ <Input
+ aria-label={t('widgets.generate.searchPromptTriggers')}
+ placeholder={t('widgets.generate.searchPromptTriggers')}
+ size="xs"
+ value={searchTerm}
+ onChange={handleSearchChange}
+ />
+ <Separator />
+ <Scrollable flex="1" label={t('widgets.generate.promptTriggerOptions')} minH="0">
+ {filteredOptions.length === 0 ? (
+ <PromptHistoryEmptyText>{t('widgets.generate.noMatchingTriggers')}</PromptHistoryEmptyText>
+ ) : (
+ <Stack gap="2">
+ {groupedOptions.map((group) => (
+ <Stack key={group.group} gap="0">
+ <Text color="fg.subtle" fontSize="2xs" fontWeight="700" px="2" textTransform="uppercase">
+ {group.group}
+ </Text>
+ {group.options.map((option, index) => (
+ <PromptTriggerOptionButton
+ key={`${option.group}-${option.value}-${index}`}
+ onSelect={onSelect}
+ option={option}
+ />
+ ))}
+ </Stack>
+ ))}
+ </Stack>
+ )}
+ </Scrollable>
+ </Stack>
+ )}
</Popover.Body>
</Popover.Content>
</Popover.Positioner>
@@ -341,7 +338,7 @@ const PromptTriggerEmptyState = () => {
const { t } = useTranslation();
return (
- <Stack align="start" gap="1" h="full" justify="center" px="2">
+ <Stack align="start" gap="1" px="1">
<Text color="fg.subtle" fontSize="xs">
{t('widgets.generate.noPromptTriggersAvailable')}
</Text>
@@ -762,7 +759,7 @@ const PositivePromptHistoryButton = ({ onUsePrompt }: Pick<PositivePromptActions
<Popover.Positioner>
<Popover.Content bg="bg.muted" borderColor="border.emphasized" borderWidth="1px" w="24rem">
<Popover.Body p="2.5">
- <Stack gap="2" h="18rem">
+ <Stack gap="2" maxH="18rem">
<HStack justify="space-between">
<Input
aria-label={t('widgets.generate.searchPromptHistory')}
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.browser.test.tsx
index 42c2e50a71..a9b3e7d500 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.browser.test.tsx
@@ -112,20 +112,26 @@ describe('the prompt templates button', () => {
expect(getComputedStyle(name!).opacity).toBe('0.5');
});
- it('stays square with nothing applied, and widens only to carry a name', async () => {
- // `px={undefined}` looks like "leave the default" but is spread over
- // Chakra's own `px: '0'`, clobbering it — the icon-only button used to be
- // 8px wider than the square buttons beside it.
+ it('is a labeled primary at rest, swapping the label for the applied name', async () => {
+ // A labeled button rather than a bare icon: "Templates" until a template is
+ // applied, then the applied template's name in its place.
await render(null);
- const bare = host!.querySelector('button')!.getBoundingClientRect();
+ const restLabel = [...host!.querySelectorAll('span')].find(
+ (span) => span.textContent === 'widgets.generate.templatesButton'
+ );
- expect(bare.width).toBeCloseTo(bare.height, 1);
+ expect(restLabel).toBeDefined();
await act(() => root?.unmount());
host?.remove();
await render(applied);
- expect(host!.querySelector('button')!.getBoundingClientRect().width).toBeGreaterThan(bare.width);
+ const name = [...host!.querySelectorAll('span')].find((span) => span.textContent === 'Cinematic');
+
+ expect(name).toBeDefined();
+ expect(
+ [...host!.querySelectorAll('span')].find((span) => span.textContent === 'widgets.generate.templatesButton')
+ ).toBeUndefined();
});
it('says nothing while the catalog is unread', async () => {
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.tsx
index f1ce74242d..d5ecf5fb44 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PromptTemplatesButton.tsx
@@ -2,7 +2,7 @@ import type { PromptTemplateSnapshot } from '@features/generation/core/promptTem
import type { PromptTemplateRecord } from '@features/generation/data/promptTemplates';
import type { PendingPromptTemplateDraft } from '@features/generation/ui/promptTemplateDraftStore';
-import { Popover, Portal } from '@chakra-ui/react';
+import { Popover, Portal, Text } from '@chakra-ui/react';
import { toPromptTemplateSnapshot } from '@features/generation/data/promptTemplates';
import { PromptTemplateEditor } from '@features/generation/ui/promptFields/PromptTemplateEditor';
import { PromptTemplatesPanel } from '@features/generation/ui/promptFields/PromptTemplatesPanel';
@@ -113,23 +113,20 @@ export const PromptTemplatesButton = ({
>
<Tooltip content={tooltip} ids={popoverIds}>
<Popover.Trigger asChild>
+ {/* A labeled primary rather than a bare icon: the label is the word
+ "Templates" until one is applied, then the applied template's name. */}
<IconButton
aria-label={t('widgets.generate.promptTemplates.title')}
- // Quiet states only: a dimmed icon when nothing is applied, the
- // template's name beside it when one is. No accent, no motion.
+ // Quiet states only: dimmed while nothing is applied. No accent, no motion.
opacity={activeTemplate ? undefined : 0.5}
- // Explicit `'0'`, not `undefined`: Chakra's IconButton spreads
- // incoming props over its own `px: '0'`, so undefined clobbers it
- // and the size recipe's `px: '2'` widened the icon-only button past
- // the square neighbours it sits beside.
- px={activeTemplate ? '1' : '0'}
+ px="1"
size="2xs"
variant="ghost"
- w={activeTemplate ? 'auto' : undefined}
+ w="auto"
>
<LayoutTemplateIcon />
{activeTemplate ? (
- // Dimmed when it is gone, the same way the icon dims when nothing
+ // Dimmed when it is gone, the same way the button dims when nothing
// is applied — one vocabulary for "not fully live", no new colour.
<MiddleTruncate
as="span"
@@ -138,7 +135,11 @@ export const PromptTemplatesButton = ({
opacity={isMissing ? 0.5 : undefined}
text={activeTemplate.name}
/>
- ) : null}
+ ) : (
+ <Text as="span" fontSize="2xs">
+ {t('widgets.generate.templatesButton')}
+ </Text>
+ )}
</IconButton>
</Popover.Trigger>
</Tooltip>
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/SystemPromptsField.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/SystemPromptsField.tsx
index 6997613740..24fadda79d 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/SystemPromptsField.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/SystemPromptsField.tsx
@@ -5,7 +5,8 @@ import type { ChangeEvent } from 'react';
import { createListCollection, HStack, Input, Stack, Text, Textarea } from '@chakra-ui/react';
import { PANEL_HEADER_CONTROL_HEIGHT, PromptPanelHeader } from '@features/generation/ui/promptFields/PromptPanelHeader';
// Imported by subpath rather than from the `@platform/ui` barrel, which is at its
-// direct-importer budget. See the note in GenerateModelFamilyFields.
+// direct-importer budget (a dev-invalidation limit) — depending on the components
+// actually used means this module only rebuilds when those change.
import { getApiErrorMessage } from '@platform/transport/http';
import { Button, IconButton } from '@platform/ui/Button';
import { ConfirmDialog } from '@platform/ui/ConfirmDialog';