2.10.0
中文
Skip to content

Prompts ​

Used to display a set of predefined questions or suggestions related to the current context.

Examples ​

Basic ​

Disabled state ​

☕️ 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?

Disabled state

To disable a prompt, add the disabled attribute to the prompt.

Fade-in effect ​

✨ Inspirational Sparks and Marvelous Tips
Fade-in effect

Controls fade-in animation effects using the fadeIn and fadeInLeft attributes.

Vertical layout ​

🤔 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?

Vertical layout

Uses the vertical attribute to control the display direction of Prompts.

Wrap ​

✨ 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?

Wrap

Use the wrap property to control whether Prompts can wrap when exceeding the container length.

Responsive width ​

✨ 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!

Responsive width

Use wrap together with styles to display at a fixed width.

Nested composition ​

Accessibility: When onItemClick is passed in, clickable prompt items will render as native buttons, can be focused with Tab, and activated with Enter / Space; disabled items will have the disabled attribute. Nested parent items and lists without onItemClick will still render as divs to avoid invalid buttons.

API ​

PromptsProps ​

PropDescriptionTypeDefaultVersion
classNamesCustom style class names, used for different parts of each prompt itemRecord<SemanticType, string>--
fadeInEnable fade-in on renderbooleanfalse-
fadeInLeftWhether to enable rendering with a left-to-right fade-inbooleanfalse-
itemsList containing multiple prompt itemsPromptProps[]--
prefixClsPrefix for style class namesstring--
rootClassNameRoot class namestring--
stylesCustom styles, used for different parts of each prompt itemRecord<SemanticType, CSSProperties>--
titleTitle displayed at the top of the prompt listVNode | string | (() => VNode | string)--
verticalWhen set to true, the prompt list will be arranged verticallybooleanfalse-
wrapWhen set to true, the prompt list will automatically wrapbooleanfalse-
onItemClickCallback function when a prompt item is clicked. If passed, clickable items are rendered as buttons and support keyboard activation(info: { data: PromptProps }) => void--

SemanticType ​

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

Prompts Slots ​

SlotDescription
titleThe title displayed at the top of the prompt list

Prompts Ref ​

PropDescriptionType
nativeElementThe root DOM element of the componentHTMLDivElement

PromptProps ​

PropertyDescriptionTypeDefaultVersion
childrenNested sub-prompt itemsPromptProps[]--
descriptionPrompt description providing additional informationVNodestring-
disabledDisables click events when set to truebooleanfalse-
iconThe prompt icon displayed on the left side of the prompt itemVNode--
keyUnique identifier used to distinguish each prompt itemstring--
labelPrompt label displaying the main content of the promptVNodestring-

Semantic DOM ​

✨ 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?

  • root
    根节点
  • title
    标题容器
  • list
    列表容器
  • item
    列表项
  • itemContent
    标题项内容
✨ 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
    子列表容器
  • subItem
    子列表项

Design Token ​

This component has no custom Component Token. Customize it through global Design Tokens.