logoAnt Design X

DesignDevelopmentComponentsPlayground
  • Overview
  • Common
    • Actions
    • Bubble
    • Conversations
  • Wake
    • Welcome
    • Prompts
  • Express
    • Attachments
    • Sender
    • Suggestion
  • Confirm
    • ThoughtChain
  • Tools
    • useXAgent
    • useXChat
    • XStream
    • XRequest
    • XProvider

Prompts

Display a predefined set of questions or suggestion.
Importimport { Prompts } from "@ant-design/x";
Sourcecomponents/prompts
Docs
Edit this pageChangelog

Resources

Ant Design
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
Twitter
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

When To Use

The Prompts component is used to display a predefined set of questions or suggestion that are relevant to the current context.

Examples

API

PromptsProps

PropertyDescriptionTypeDefaultVersion
classNamesCustom style class names for different parts of each prompt item.Record<SemanticType, string>--
itemsList containing multiple prompt items.PromptProps[]--
prefixClsPrefix for style class names.string--
rootClassNameStyle class name for the root node.string--
stylesCustom styles for different parts of each prompt item.Record<SemanticType, React.CSSProperties>--
titleTitle displayed at the top of the prompt list.React.ReactNode--
verticalWhen set to true, the Prompts will be arranged vertically.booleanfalse-
wrapWhen set to true, the Prompts will automatically wrap.booleanfalse-
onItemClickCallback function when a prompt item is clicked.(info: { data: PromptProps }) => void--

SemanticType

typescript
type SemanticType = 'list' | 'item' | 'content' | 'title' | 'subList' | 'subItem';

PromptProps

PropertyDescriptionTypeDefaultVersion
childrenNested child prompt items.PromptProps[]--
descriptionPrompt description providing additional information.React.ReactNode--
disabledWhen set to true, click events are disabled.booleanfalse-
iconPrompt icon displayed on the left side of the prompt item.React.ReactNode--
keyUnique identifier used to distinguish each prompt item.string--
labelPrompt label displaying the main content of the prompt.React.ReactNode--

Semantic DOM

Design Token

Basic

Basic usage.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Disabled

To mark a prompt as disabled, add the disabled property to the prompt item.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Vertical

Use the vertical property to control the Prompts' display direction.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Wrap

Use the wrap attribute to control the layout of the Prompts.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Responsive Size

Use the wrap and styles properties to display with a fixed width.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
Nest Usage

Nest usage.

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
✨ Inspirational Sparks and Marvelous Tips
Ignite Your Creativity

Got any sparks for a new project?

Uncover Background Info

Help me understand the background of this topic.

Efficiency Boost Battle

How can I work faster and better?

Tell me a Joke

Why do not ants get sick? Because they have tiny ant-bodies!

Common Issue Solutions

How to solve common issues? Share some tips!

☕️ It's time to relax!
Task Completion Secrets

What are some tricks for getting tasks done?

Time for a Coffee Break

How to rest effectively after long hours of work?

🤔 You might also want to ask:

How to rest effectively after long hours of work?

What are the secrets to maintaining a positive mindset?

How to stay calm under immense pressure?

✨ Inspirational Sparks and Marvelous Tips

Got any sparks for a new project?

Help me understand the background of this topic.

How to solve common issues? Share some tips!

How can I work faster and better?

What are some tricks for getting tasks done?

How to rest effectively after long hours of work?

What are the secrets to maintaining a positive mindset?

How to stay calm under immense pressure?

✨ Inspirational Sparks and Marvelous Tips
Ignite Your Creativity

Got any sparks for a new project?

Uncover Background Info

Help me understand the background of this topic.

Efficiency Boost Battle

How can I work faster and better?

Tell me a Joke

Why do not ants get sick? Because they have tiny ant-bodies!

Common Issue Solutions

How to solve common issues? Share some tips!

Do you want?
Hot Topics

What are you interested in?

What's new in X?

What's AGI?

Where is the doc?

Design Guide

How to design a good product?

Know the well

Set the AI role

Express the feeling

Start Creating

How to start a new project?

Fast Start

Install Ant Design X

Online Playground

Play on the web without installing

✨ Inspirational Sparks and Marvelous Tips
Ignite Your Creativity

Got any sparks for a new project?

Uncover Background Info

Help me understand the background of this topic.

Efficiency Boost Battle

How can I work faster and better?

  • title
    Title container
  • list
    List container
  • item
    List item
  • itemContent
    List item content
✨ Nested Prompts
🔥 Ignite Your Creativity

What sparks your creativity?

How do you get inspired?

🎨 Uncover Background Info

What is the background of this topic?

Why is this important?

  • subList
    Sub-list container
  • subItem
    Sub-list item