---
title: Suggestions
description: Prompt suggestion chips for guiding user input
---
import SuggestionDefault from "@/components/nexus-ui/examples/suggestion/default";
import SuggestionVertical from "@/components/nexus-ui/examples/suggestion/vertical";
import SuggestionCustomValue from "@/components/nexus-ui/examples/suggestion/custom-value";
import SuggestionWithIcons from "@/components/nexus-ui/examples/suggestion/with-icons";
import SuggestionWithPromptInput from "@/components/nexus-ui/examples/suggestion/with-prompt-input";
import SuggestionVariants from "@/components/nexus-ui/examples/suggestion/variants";
import SuggestionWithPanel from "@/components/nexus-ui/examples/suggestion/with-panel";
Clickable prompt suggestion chips that guide users toward common queries. Built on shadcn's `Button` with a composable compound pattern.
## Installation
```bash
npx shadcn@latest add @nexus-ui/suggestions
```
```bash
pnpm dlx shadcn@latest add @nexus-ui/suggestions
```
```bash
yarn dlx shadcn@latest add @nexus-ui/suggestions
```
```bash
bunx shadcn@latest add @nexus-ui/suggestions
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage
```tsx keepBackground
import {
Suggestions,
SuggestionList,
Suggestion,
} from "@/components/nexus-ui/suggestions";
```
```tsx keepBackground
handleSuggestion(value)}>
Tell me a joke
Explain quantum computing
```
## Examples
### Variants
The `Suggestion` component supports three variants: `filled` (filled background), `outline` (bordered), and `ghost` (transparent until hovered).
### Vertical Layout
Use `orientation="vertical"` on `SuggestionList` to stack suggestions in a column.
### With Custom Value
Use the `value` prop when the display text differs from the value passed to `onSelect`.
### With Icons
Since `Suggestion` renders a shadcn `Button`, you can add icons alongside text.
### With Prompt Input
Clicking a suggestion populates the `PromptInput` textarea, combining both components.
### With Panel
Category chips that open a panel with related suggestions. Uses the `highlight` prop to style matching terms.
## Vercel AI SDK Integration
Combine Suggestions with [Prompt Input](/docs/components/prompt-input) and the [Vercel AI SDK](https://sdk.vercel.ai) for a chat interface with quick-start prompts.
Install the AI SDK
```bash
npm install ai @ai-sdk/react @ai-sdk/openai
```
Create your chat API route
See [Prompt Input docs](/docs/components/prompt-input#vercel-ai-sdk-integration) for the route implementation.
Wire Suggestions + Prompt Input to `useChat`
```tsx
"use client";
import { useState } from "react";
import { useChat } from "@ai-sdk/react";
import { DefaultChatTransport } from "ai";
import { Button } from "@/components/ui/button";
import PromptInput, {
PromptInputActions,
PromptInputAction,
PromptInputActionGroup,
PromptInputTextarea,
} from "@/components/nexus-ui/prompt-input";
import {
Suggestions,
SuggestionList,
Suggestion,
} from "@/components/nexus-ui/suggestions";
import {
ArrowUp02Icon,
PlusSignIcon,
SquareIcon,
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
export default function ChatWithSuggestions() {
const { sendMessage, status } = useChat({
transport: new DefaultChatTransport({ api: "/api/chat" }),
});
const [input, setInput] = useState("");
const isLoading = status !== "ready";
const handleSubmit = (e?: React.FormEvent) => {
e?.preventDefault();
if (input.trim()) {
sendMessage({ text: input });
setInput("");
}
};
return (
setInput(value)}>
What is AI?
Teach me Engineering from scratch
How to learn React?
Design a weekly workout plan
Places to visit in France
);
}
```
For one-click submission (suggestion sends immediately without editing), call `sendMessage` in `onSelect`:
```tsx
{
if (value.trim()) {
sendMessage({ text: value });
setInput("");
}
}}
>
```
## API Reference
### Suggestions
The root container that provides `onSelect` context to all child `Suggestion` components. Extends `React.HTMLAttributes`.
void",
description:
"Callback fired when any Suggestion is clicked. Receives the suggestion's value or text content.",
},
className: {
type: "string",
description: "Additional CSS classes to apply to the root container.",
},
}}
/>
### SuggestionList
Layout wrapper for arranging suggestions horizontally or vertically. Extends `React.HTMLAttributes`.
### Suggestion
A clickable pill that triggers `onSelect` from the parent `Suggestions` context. Renders as a shadcn `Button`. Extends `Button` props (except `variant`).
",
description: "Optional click handler. Called before onSelect.",
},
className: {
type: "string",
description: "Additional CSS classes to apply to the button.",
},
}}
/>
### SuggestionPanel
Full-width panel that displays below the input, covering the category pills. Uses `Presence` for enter/exit animations. Closes on Escape via `onOpenChange`. Use with `SuggestionPanelHeader`, `SuggestionPanelTitle`, `SuggestionPanelClose`, and `SuggestionPanelContent`.
void",
description:
"Callback fired when the panel open state changes (e.g. Escape key, SuggestionPanelClose click).",
},
onClose: {
type: "() => void",
description:
"Callback fired when the panel's exit animation completes. Use for cleanup (e.g. focus management).",
},
className: {
type: "string",
description: "Additional CSS classes to apply to the panel container.",
},
ref: {
type: "React.Ref",
description: "Forwarded ref to the panel div element.",
},
}}
/>
### SuggestionPanelHeader
Header row for the panel. Typically contains `SuggestionPanelTitle` and `SuggestionPanelClose`. Extends `React.HTMLAttributes`.
### SuggestionPanelTitle
Title area for the panel header. Use for the category icon and label. Extends `React.HTMLAttributes`.
### SuggestionPanelClose
Close button for the panel. Clicking it calls `onOpenChange(false)` via context. Use `asChild` to merge props onto a child element. Extends `React.ButtonHTMLAttributes`.
",
description: "Optional click handler. Called after the panel close is triggered.",
},
className: {
type: "string",
description: "Additional CSS classes to apply to the close button.",
},
}}
/>
### SuggestionPanelContent
Content wrapper for the panel's suggestion list. Use with `Suggestions` and `SuggestionList` inside. Use `asChild` to merge props onto a child element. Extends `React.HTMLAttributes`.