Generative UX
Building dynamic interfaces with Hydra AI components.
Hydra AI enables you to create dynamic interfaces by orchestrating your React components. This guide will show you how to build components that work seamlessly with Hydra.
We'll cover two main approaches:
- Display only components
- Interactive components
Why make components interactive?
Let's say the user updates a component text value, and then ask your AI assistant can you edit the text. Hydra will use the same state of the component in the follow up message as context!
Our react hooks give yous out of the box:
- Persistence
- Type safety
- Inclusion in subsequent messages
With no extra work on your part!
Simple Display Components
This is the simplest form of component. It takes in props and displays data.
Interactive Components
This is a little more complex. It takes in props and displays data. It also has a state that can be updated.
But we provide you with hooks to manage the state and validation that make it easy to create interactive components, with persistence, validation, and inclusion in subsequent messages.
Need another example?
Here is a form component that has a state that can be updated.
What's happening here?
- We're using the
useHydraState
hook to manage the state of the form. - We're using the
HydraMessageContext
to keep track of the form data in the chat history.
Looking for streaming?