+ {HeaderComponent && hasContent && (
+
+ )}
+ {isLoading && suggestions.length === 0 ? (
+
+ {[...new Array(skeletonCount)].map((_, i) => (
+
+ ))}
+
+ ) : (
+ suggestions.map((suggestion, index) => (
+
+ ))
+ )}
+
+ );
+ };
+}
diff --git a/packages/instantsearch-ui-components/src/components/index.ts b/packages/instantsearch-ui-components/src/components/index.ts
index aaa5df4b9e6..f845e3d0bb8 100644
--- a/packages/instantsearch-ui-components/src/components/index.ts
+++ b/packages/instantsearch-ui-components/src/components/index.ts
@@ -12,7 +12,7 @@ export * from './chat/ChatMessageLoader';
export * from './chat/ChatMessageError';
export * from './chat/ChatGreeting';
export * from './chat/ChatPrompt';
-export * from './chat/ChatPromptSuggestions';
+export * from './chat/OnPageSuggestions';
export * from './chat/ChatToggleButton';
export * from './chat/icons';
export * from './chat/tools/DisplayResultsTool';
diff --git a/packages/instantsearch.css/src/components/chat/_chat-suggestions.scss b/packages/instantsearch.css/src/components/chat/_chat-suggestions.scss
index e9624dd3382..afdb10483cd 100644
--- a/packages/instantsearch.css/src/components/chat/_chat-suggestions.scss
+++ b/packages/instantsearch.css/src/components/chat/_chat-suggestions.scss
@@ -1,13 +1,25 @@
@use '../../shared/_common';
@use '../../shared/_variables';
-.ais-ChatPromptSuggestions {
+.ais-OnPageSuggestions {
display: flex;
flex-direction: column;
gap: calc(var(--ais-spacing) * 0.5);
}
-.ais-ChatPromptSuggestions-suggestion {
+.ais-OnPageSuggestions-header {
+ display: flex;
+ align-items: center;
+ gap: calc(var(--ais-spacing) * 0.5);
+}
+
+.ais-OnPageSuggestions-headerTitle {
+ font-size: var(--ais-font-size-sm);
+ font-weight: 500;
+ color: rgba(var(--ais-text-color-rgb), var(--ais-text-color-alpha));
+}
+
+.ais-OnPageSuggestions-suggestion {
font-size: revert;
line-height: var(--ais-spacing);
width: fit-content;
@@ -36,3 +48,47 @@
}
}
+.ais-OnPageSuggestions-skeleton {
+ display: flex;
+ flex-direction: column;
+ gap: calc(var(--ais-spacing) * 0.5);
+}
+
+.ais-OnPageSuggestions-skeletonItem {
+ height: calc(var(--ais-spacing) * 2);
+ border-radius: var(--ais-border-radius-lg);
+ background-color: rgba(var(--ais-muted-color-rgb), 0.15);
+ animation: ais-chat-prompt-suggestions-skeleton 1.5s ease-in-out infinite;
+
+ // Varying widths so the skeleton row mimics real pills.
+ &:nth-child(1) {
+ width: 65%;
+ }
+
+ &:nth-child(2) {
+ width: 80%;
+ }
+
+ &:nth-child(3) {
+ width: 55%;
+ }
+
+ &:nth-child(4) {
+ width: 70%;
+ }
+
+ &:nth-child(5) {
+ width: 60%;
+ }
+}
+
+@keyframes ais-chat-prompt-suggestions-skeleton {
+ 0%,
+ 100% {
+ opacity: 1;
+ }
+ 50% {
+ opacity: 0.4;
+ }
+}
+
diff --git a/packages/instantsearch.js/src/__tests__/common-widgets.test.tsx b/packages/instantsearch.js/src/__tests__/common-widgets.test.tsx
index 1a8531fe3ec..1c2e1c21432 100644
--- a/packages/instantsearch.js/src/__tests__/common-widgets.test.tsx
+++ b/packages/instantsearch.js/src/__tests__/common-widgets.test.tsx
@@ -36,6 +36,7 @@ import {
dynamicWidgets,
chat,
chatTrigger,
+ onPageSuggestions,
EXPERIMENTAL_autocomplete,
filterSuggestions,
} from '../widgets';
@@ -745,6 +746,25 @@ const testSetups: TestSetupsMap