Suggested prompts and starter actions for AI chat empty states.
Suggested prompts and starter actions for AI chat empty states.
import { PromptSuggestion } from 'heroui-native-pro' ;
< PromptSuggestion >
< PromptSuggestion.Header >
< PromptSuggestion.Title >...</ PromptSuggestion.Title >
< PromptSuggestion.Description >...</ PromptSuggestion.Description >
</ PromptSuggestion.Header >
< PromptSuggestion.Group label = "..." description = "..." >
< PromptSuggestion.Items >
< PromptSuggestion.Item >
< PromptSuggestion.ItemHeader >
< PromptSuggestion.ItemTitle >...</ PromptSuggestion.ItemTitle >
< PromptSuggestion.ItemDescription >...</ PromptSuggestion.ItemDescription >
</ PromptSuggestion.ItemHeader >
< PromptSuggestion.ItemFooter >
< PromptSuggestion.ItemTags >...</ PromptSuggestion.ItemTags >
< PromptSuggestion.ItemMeta >...</ PromptSuggestion.ItemMeta >
</ PromptSuggestion.ItemFooter >
</ PromptSuggestion.Item >
</ PromptSuggestion.Items >
</ PromptSuggestion.Group >
</ PromptSuggestion >
PromptSuggestion : Root column. Sets the variant shared by every item.
PromptSuggestion.Header : Groups the title and description.
PromptSuggestion.Title : Screen heading, announced as a header.
PromptSuggestion.Description : Supporting text under the title.
PromptSuggestion.Group : Section with an optional label and description. The label is announced as a header.
PromptSuggestion.Items : List of items, either a full-width column or a horizontally scrolling strip.
PromptSuggestion.Item : Pressable suggestion, a button or (with href) a link. A pill shows its text and a trailing chevron. A card is a heroui-native Card built from the item parts below.
PromptSuggestion.ItemHeader : Card.Header grouping the card title and description.
PromptSuggestion.ItemTitle : Card.Title sized for prompt cards. Screen readers announce the card by its text.
PromptSuggestion.ItemDescription : Card.Description sized for prompt cards. Screen readers read it as the card's hint.
PromptSuggestion.ItemFooter : Card.Footer laid out as a row and pinned to the bottom of the card.
PromptSuggestion.ItemTags : Wrapping row of tags, for example Chips.
PromptSuggestion.ItemMeta : Small muted text, such as an estimated time.
Pills stack full-width by default. Handle the press with onPress, for example to send the prompt as the first message.
< PromptSuggestion >
< PromptSuggestion.Header >
< PromptSuggestion.Title >What do you want to work on?</ PromptSuggestion.Title >
< PromptSuggestion.Description >
Ask a question or start from one of the suggestions below.
</ PromptSuggestion.Description >
</ PromptSuggestion.Header >
< PromptSuggestion.Items >
{prompts. map ((prompt) => (
< PromptSuggestion.Item key ={prompt} onPress ={() => send (prompt)}>
{prompt}
</ PromptSuggestion.Item >
))}
</ PromptSuggestion.Items >
</ PromptSuggestion >
orientation="horizontal" renders a horizontally scrolling strip, a common pattern above the chat composer. Pills size to their text (up to 288px wide) and cards share a 256px width. To bleed the strip to the screen edges, pair a negative container margin with matching content padding.
< PromptSuggestion.Items
orientation = "horizontal"
classNames ={{ container: '-mx-5' , content: 'px-5' }}
>
...
</ PromptSuggestion.Items >
variant="card" renders each item as a heroui-native Card. Group the cards under a label and description, and put the title and description of each card in an ItemHeader. A card is announced by its ItemTitle and described by its ItemDescription; tags and meta are left out.
< PromptSuggestion variant = "card" >
< PromptSuggestion.Group
label = "At work"
description = "Planning, updates, and stakeholder communication."
>
< PromptSuggestion.Items >
< PromptSuggestion.Item onPress ={startWeeklyUpdate}>
< PromptSuggestion.ItemHeader >
< PromptSuggestion.ItemTitle >Weekly project update</ PromptSuggestion.ItemTitle >
< PromptSuggestion.ItemDescription >
Turn rough notes into a clear weekly update.
</ PromptSuggestion.ItemDescription >
</ PromptSuggestion.ItemHeader >
</ PromptSuggestion.Item >
</ PromptSuggestion.Items >
</ PromptSuggestion.Group >
</ PromptSuggestion >
ItemFooter is a row pinned to the bottom of the card, so footers line up across a horizontal strip of cards with different text lengths. Tags let touches through to the card by default, because heroui-native Chip is pressable. Pass pointerEvents="auto" to ItemTags for interactive tags.
< PromptSuggestion.ItemFooter >
< PromptSuggestion.ItemTags >
< Chip size = "sm" variant = "soft" color = "default" >Writing</ Chip >
</ PromptSuggestion.ItemTags >
< PromptSuggestion.ItemMeta >2 min</ PromptSuggestion.ItemMeta >
</ PromptSuggestion.ItemFooter >
Text children render as the pill label. Any other children render as-is, next to the chevron. Hide the chevron with showEndIcon={false}.
< PromptSuggestion.Item showEndIcon ={ false }>
< View className = "flex-1 flex-row items-start gap-3" >
< SparklesIcon size ={ 18 } />
< Text className = "flex-1 text-sm text-foreground" >Rewrite my last message</ Text >
</ View >
</ PromptSuggestion.Item >
Disabled items are dimmed and ignore presses.
< PromptSuggestion.Item isDisabled >
Explain this error message in plain language
</ PromptSuggestion.Item >
Set href to make an item a link. It gets the link role and opens the URL on press, after onPress. Call event.preventDefault() in onPress to keep the URL from opening, or pass onOpenUrl to open it yourself, for example in an in-app browser. Don't put other buttons or links inside an item.
< PromptSuggestion.Item href = "https://heroui.com/docs" onOpenUrl ={openInAppBrowser}>
Read the docs
</ PromptSuggestion.Item >
To send a suggestion from a composer in ChatConversation, render the suggestions inside its PromptInput and call submit(prompt) from usePromptInput() in onPress. The send then moves the list and the keyboard like Send does. See Sending from outside the field .
const Suggestions = () => {
const { submit } = usePromptInput ();
return (
< PromptSuggestion >
< PromptSuggestion.Items orientation = "horizontal" >
{prompts. map ((prompt) => (
< PromptSuggestion.Item key ={prompt} onPress ={() => submit (prompt)}>
{prompt}
</ PromptSuggestion.Item >
))}
</ PromptSuggestion.Items >
</ PromptSuggestion >
);
};
< PromptInput value ={value} onValueChange ={setValue} onSubmit ={send}>
{messages.length === 0 ? < Suggestions /> : null }
< PromptInput.Shell >...</ PromptInput.Shell >
</ PromptInput >;
Items scale down and show a highlight overlay while pressed. The highlight peaks at 5% opacity, half the heroui-native PressableFeedback.Highlight default. Customize both with animation, or turn them off for every item with animation="disable-all" on the root.
< PromptSuggestion.Item animation ={{ scale: { value: 0.97 }, highlight: { opacity: { value: [ 0 , 0.15 ] } } }} />
< PromptSuggestion.Item animation ={{ scale: false }} />
< PromptSuggestion animation = "disable-all" >...</ PromptSuggestion >
import { Chip } from 'heroui-native' ;
import { PromptSuggestion } from 'heroui-native-pro' ;
import { View } from 'react-native' ;
const CARDS = [
{
id: 'weekly-update' ,
title: 'Weekly project update' ,
description: 'Turn rough notes into a clear weekly update.' ,
tags: [ 'Writing' , 'Team' ],
meta: '2 min' ,
},
{
id: 'meeting-summary' ,
title: 'Meeting summary' ,
description: 'Capture decisions, owners, and next steps.' ,
tags: [ 'Notes' ],
meta: '1 min' ,
},
{
id: 'launch-plan' ,
title: 'Launch planning' ,
description: 'Outline milestones, risks, and launch tasks.' ,
tags: [ 'Planning' , 'Product' ],
meta: '5 min' ,
},
];
export default function ChatEmptyState ({
onSend,
}: {
onSend : (prompt: string ) => void ;
}) {
return (
< View className = "flex-1 px-5 justify-center" >
< PromptSuggestion variant = "card" >
< PromptSuggestion.Header >
< PromptSuggestion.Title >How can I help?</ PromptSuggestion.Title >
< PromptSuggestion.Description >
Start from one of the suggestions below.
</ PromptSuggestion.Description >
</ PromptSuggestion.Header >
< PromptSuggestion.Group label = "Explore" >
< PromptSuggestion.Items
orientation = "horizontal"
classNames ={{ container: '-mx-5' , content: 'px-5 py-1' }}
>
{CARDS. map ((card) => (
< PromptSuggestion.Item
key ={card.id}
onPress ={() => onSend (card.title)}
>
< PromptSuggestion.ItemHeader >
< PromptSuggestion.ItemTitle >
{card.title}
</ PromptSuggestion.ItemTitle >
< PromptSuggestion.ItemDescription >
{card.description}
</ PromptSuggestion.ItemDescription >
</ PromptSuggestion.ItemHeader >
< PromptSuggestion.ItemFooter >
< PromptSuggestion.ItemTags >
{card.tags. map ((tag) => (
< Chip key ={tag} size = "sm" variant = "soft" color = "default" >
{tag}
</ Chip >
))}
</ PromptSuggestion.ItemTags >
< PromptSuggestion.ItemMeta >{card.meta}</ PromptSuggestion.ItemMeta >
</ PromptSuggestion.ItemFooter >
</ PromptSuggestion.Item >
))}
</ PromptSuggestion.Items >
</ PromptSuggestion.Group >
</ PromptSuggestion >
</ View >
);
}
prop type default description childrenReactNode- Header, groups, and item lists variant'pill' | 'card''pill'Visual variant shared by every item classNamestring- Additional CSS classes for the root column animationPromptSuggestionRootAnimation- Animation configuration for the root ...ViewPropsViewProps- All standard React Native View props are supported
Animation configuration for the root. Can be:
'disable-all': Disable the press feedback of every item
undefined: Use default animations
prop type default description childrenReactNode- Title and description classNamestring- Additional CSS classes ...ViewPropsViewProps- All standard React Native View props are supported
prop type default description childrenReactNode- Title text classNamestring- Additional CSS classes ...TextPropsTextProps- All standard React Native Text props are supported
prop type default description childrenReactNode- Description text classNamestring- Additional CSS classes ...TextPropsTextProps- All standard React Native Text props are supported
prop type default description childrenReactNode- Usually a PromptSuggestion.Items list labelReactNode- Group heading. Text renders in the label slot; other nodes render as-is descriptionReactNode- Supporting text. Text renders in the description slot; other nodes render as-is classNamestring- Additional CSS classes for the container classNamesElementSlots<GroupSlots>- Additional CSS classes for the slots styles{ container?: ViewStyle; header?: ViewStyle; label?: TextStyle; description?: TextStyle }- Styles for the slots ...ViewPropsViewProps- All standard React Native View props are supported
prop type description containerstringGroup column headerstringWrapper of the label and description, rendered when either is set labelstringGroup heading text descriptionstringSupporting text under the label
prop type description containerViewStyleGroup column headerViewStyleWrapper of the label and description labelTextStyleGroup heading text descriptionTextStyleSupporting text under the label
prop type default description childrenReactNode- PromptSuggestion.Item elementsorientation'vertical' | 'horizontal''vertical'Full-width column, or horizontally scrolling strip classNamestring- Additional CSS classes for the container classNamesElementSlots<ItemsSlots>- Additional CSS classes for the slots stylesPartial<Record<ItemsSlots, ViewStyle>>- Styles for the slots ...ViewPropsViewProps- All standard React Native View props are supported
prop type description containerstringOuter view scrollViewstringHorizontal ScrollView (horizontal only) contentstringScrollView content row (horizontal only)
prop type description containerViewStyleOuter view scrollViewViewStyleHorizontal ScrollView (horizontal only) contentViewStyleScrollView content row (horizontal only)
prop type default description childrenReactNode- Prompt text (pill) or card content (card) showEndIconbooleantrueWhether the pill shows the trailing chevron isDisabledbooleanfalseWhether the item is disabled and dimmed classNamestring- Additional CSS classes for the pressable classNamesElementSlots<ItemSlots>- Additional CSS classes for the slots styles{ container?: ViewStyle; label?: TextStyle; endIcon?: ViewStyle; card?: ViewStyle }- Styles for the slots hrefstring- Makes the item a link (link role) that opens this URL on press accessibilityLabelstringcard: ItemTitle text Screen reader label. A pill is announced by its text accessibilityHintstringcard: ItemDescription text Screen reader hint onPress(event: GestureResponderEvent) => void- Called when the item is pressed, before href opens. event.preventDefault() keeps it closed onOpenUrl(href: string) => void- Opens href instead of Linking.openURL animationPromptSuggestionItemAnimation- Press scale and highlight configuration ...PressableFeedbackPropsPressableFeedbackProps- heroui-native PressableFeedback props, without asChild and isAnimatedStyleActive
prop type description containerstringPressable labelstringPill text (pill, text children only) endIconstringTrailing chevron wrapper (pill) cardstringheroui-native Card surface (card)
prop type description containerViewStylePressable labelTextStylePill text (pill, text children only) endIconViewStyleTrailing chevron wrapper (pill) cardViewStyleheroui-native Card surface (card)
Animation configuration for the item press feedback. Can be:
false or 'disabled': No press scale and no highlight animation
'disable-all': Disable all animations, including animated children of a card
true or undefined: Use default animations
object: Custom animation configuration
prop type default description state'disabled' | 'disable-all' | boolean- Disable animations while customizing properties scalePressableFeedbackScaleAnimation- Press scale. false keeps only the highlight scale.valuenumber0.985Scale when pressed scale.timingConfigWithTimingConfig{ duration: 300, easing: Easing.out(Easing.ease) }Scale timing scale.ignoreScaleCoefficientbooleanfalseUses scale.value regardless of the item width highlightPressableFeedbackHighlightAnimation- Highlight overlay. false disables it highlight.opacity.value[number, number][0, 0.05]Opacity [unpressed, pressed] highlight.opacity.timingConfigWithTimingConfig{ duration: 200 }Opacity timing highlight.backgroundColor.valuestringtheme-based Highlight color
prop type default description childrenReactNode- ItemTitle and ItemDescriptionclassNamestring- Additional CSS classes ...CardHeaderPropsCardHeaderProps- heroui-native Card.Header props
prop type default description childrenReactNode- Title text classNamestring- Additional CSS classes ...CardTitlePropsCardTitleProps- heroui-native Card.Title props
prop type default description childrenReactNode- Description text classNamestring- Additional CSS classes ...CardDescriptionPropsCardDescriptionProps- heroui-native Card.Description props
prop type default description childrenReactNode- ItemTags and ItemMetaclassNamestring- Additional CSS classes ...CardFooterPropsCardFooterProps- heroui-native Card.Footer props
prop type default description childrenReactNode- Tag elements classNamestring- Additional CSS classes pointerEventsViewProps['pointerEvents']'none'Touches pass through to the item. Pass 'auto' for interactive tags ...ViewPropsViewProps- All standard React Native View props are supported
prop type default description childrenReactNode- Meta text classNamestring- Additional CSS classes ...TextPropsTextProps- All standard React Native Text props are supported