Install chatty-form and it's peer dependency in your project from npm or yarn
npm install chatty-form framer-motion # or yarn add chatty-form framer-motion
This package contains only 4 components. A parent ChattyForm component and three input components Input, Select & MultiSelect which interact with the user.
Wrap any of the input component in <Chattyform/>
to get started. Let's write the basic amount of code to get it up and running.
import { ChattyForm, Input } from 'chatty-form';
<ChattyForm> <Input name="name" question="Howdy! What's your name?" placeholder="Type your answer" /> </ChattyForm>
There you go! We are now successfully using chatty-form.
According the the library semantics and the naming used internally, each chat block of UI which captures the user's input contains a question block, an InputSection and the answer block.
The flow of the UI is as follows.