Suggestion Chips

Prompts to start from, or follow-up questions after an answer.

What are we brewing today?

'use client';

import { useState } from 'react';
import { SuggestionChips } from '@brand-studio/ui';

export default function SuggestionChipsDemo() {
  const [asked, setAsked] = useState<string>();
  return (
    <div style={{ width: '100%', maxWidth: 520, display: 'grid', gap: 16, textAlign: 'center', justifyItems: 'center' }}>
      <h3 style={{ margin: 0, fontSize: 22 }}>{asked ?? 'What are we brewing today?'}</h3>
      <SuggestionChips
        key={asked}
        label={asked ? 'Follow-up questions' : 'Ways to start'}
        suggestions={asked ? ['Why that grind size?', 'What if I only have a French press?', 'Save this recipe'] : ['Dial in a new bag', 'Which beans are ready?', 'Plan this week’s roasts', 'Write tasting notes']}
        onSelect={setAsked}
      />
    </div>
  );
}

Installation

pnpm add @brand-studio/ui

Usage

import { SuggestionChips } from '@brand-studio/ui';
<SuggestionChips
  label="Follow-up questions"
  suggestions={['Why that grind size?', 'Save this recipe']}
  onSelect={ask}
/>

The chips arrive one after another. Change the component's key to play the entrance again for a new set.

Accessibility

  • The chips are a list of buttons named by label.
  • With reduced motion they show at once.

API Reference

PropTypeDefault
suggestionsstring[]
onSelect?((suggestion: string) => void)
label?string'Suggestions'
className?string''

Still, Deskhand and Hollis are fictional brands. The coffee photographs are original generated artwork. @brand-studio/ui is MIT licensed.