Back to Blog
January 4, 20268 min readReplay AI: How

Replay AI: How to Reconstruct Complex Data Tables from Video

R
Replay Team
Developer Advocates

TL;DR: Replay AI uses behavior-driven reconstruction to analyze video recordings and generate functional data tables, understanding user intent beyond visual appearance.

The promise of AI-powered code generation is tantalizing. But current "screenshot-to-code" tools often fall short when dealing with complex UI elements like data tables. They see pixels, not structure. They struggle to understand the underlying logic that governs data interaction. This is especially true when reconstructing data tables from video, where understanding user behavior and data flow is paramount. Replay addresses this limitation head-on.

The Problem with Traditional Screenshot-to-Code#

Screenshot-to-code tools are inherently limited by their reliance on visual information alone. They can identify basic UI elements, but they struggle to infer relationships between them, especially within complex structures like data tables. Consider these limitations:

  • Lack of Context: Screenshots provide no information about user interactions or data flow. A table might look like it contains sortable columns, but the tool has no way of knowing if that's the case.
  • Static Representation: Screenshots capture a single moment in time. They don't reflect dynamic behavior, such as filtering, pagination, or data updates.
  • Inability to Handle Complex Logic: Reconstructing complex table functionality, such as calculated columns or data validation, is beyond the capabilities of screenshot-based tools.
FeatureScreenshot-to-CodeReplay
InputStatic ImageVideo
Behavior Analysis
Dynamic Reconstruction
Understanding User Intent
Complex Table HandlingLimitedExcellent

Replay solves these problems by analyzing video, not just screenshots.

Behavior-Driven Reconstruction: Video as the Source of Truth#

Replay's approach, which we call "Behavior-Driven Reconstruction," treats video as the source of truth. By analyzing user interactions within the video, Replay can infer the underlying logic and functionality of the UI, including complex data tables. This allows Replay to generate code that accurately reflects the intended behavior, not just the visual appearance.

Here's how it works:

  1. Video Analysis: Replay analyzes the video recording, identifying UI elements and tracking user interactions (clicks, scrolls, form inputs, etc.).
  2. Behavioral Inference: Replay's AI engine infers the relationships between UI elements and the user's intent. For example, it can identify column headers that trigger sorting, form fields that filter data, and buttons that trigger pagination.
  3. Code Generation: Replay generates clean, functional code that replicates the observed behavior, including data fetching, state management, and UI updates.
  4. Supabase Integration: Replay can automatically connect to your Supabase database, allowing you to easily populate the generated tables with real data.
  5. Style Injection: Replay allows you to inject custom styles to match your existing design system, ensuring a consistent look and feel.

Reconstructing Data Tables with Replay: A Step-by-Step Guide#

Let's walk through the process of reconstructing a data table from a video using Replay. For this example, we'll assume you have a video recording of a user interacting with a table that displays a list of customers, with sortable columns and a search filter.

Step 1: Upload Your Video to Replay#

The first step is to upload your video recording to the Replay platform. Replay supports various video formats and resolutions.

Step 2: Define the Target Table Area#

Using Replay's intuitive interface, you'll define the area in the video that contains the data table you want to reconstruct. This helps Replay focus its analysis on the relevant portion of the video.

Step 3: Initiate Reconstruction#

Once you've defined the target area, you can initiate the reconstruction process. Replay will analyze the video and generate the code for the data table. This process typically takes a few minutes, depending on the complexity of the table and the length of the video.

Step 4: Review and Refine the Generated Code#

After the reconstruction process is complete, you can review the generated code and make any necessary refinements. Replay provides a code editor with syntax highlighting and error checking, making it easy to modify the code.

Step 5: Integrate with Your Project#

Once you're satisfied with the generated code, you can integrate it into your project. Replay supports various frameworks and libraries, including React, Vue.js, and Angular.

Here's an example of code that Replay might generate for a simple React table:

typescript
// React component for displaying a data table import React, { useState, useEffect } from 'react'; interface Customer { id: number; name: string; email: string; city: string; } const CustomerTable = () => { const [customers, setCustomers] = useState<Customer[]>([]); const [searchTerm, setSearchTerm] = useState(''); const [sortBy, setSortBy] = useState<keyof Customer>('name'); const [sortOrder, setSortOrder] = useState<'asc' | 'desc'>('asc'); useEffect(() => { // Fetch data from API (replace with your actual API endpoint) const fetchData = async () => { const response = await fetch('/api/customers'); const data = await response.json(); setCustomers(data); }; fetchData(); }, []); const handleSearch = (event: React.ChangeEvent<HTMLInputElement>) => { setSearchTerm(event.target.value); }; const handleSort = (column: keyof Customer) => { if (sortBy === column) { setSortOrder(sortOrder === 'asc' ? 'desc' : 'asc'); } else { setSortBy(column); setSortOrder('asc'); } }; const filteredCustomers = customers.filter((customer) => customer.name.toLowerCase().includes(searchTerm.toLowerCase()) ); const sortedCustomers = [...filteredCustomers].sort((a, b) => { const order = sortOrder === 'asc' ? 1 : -1; if (a[sortBy] < b[sortBy]) return -1 * order; if (a[sortBy] > b[sortBy]) return 1 * order; return 0; }); return ( <div> <input type="text" placeholder="Search by name" value={searchTerm} onChange={handleSearch} /> <table> <thead> <tr> <th onClick={() => handleSort('name')}>Name</th> <th onClick={() => handleSort('email')}>Email</th> <th onClick={() => handleSort('city')}>City</th> </tr> </thead> <tbody> {sortedCustomers.map((customer) => ( <tr key={customer.id}> <td>{customer.name}</td> <td>{customer.email}</td> <td>{customer.city}</td> </tr> ))} </tbody> </table> </div> ); }; export default CustomerTable;

💡 Pro Tip: When recording your video, make sure to clearly demonstrate all the desired functionality of the data table, including sorting, filtering, and pagination. This will help Replay accurately infer the underlying logic.

Step 6: Connect to Supabase (Optional)#

If your data table is backed by a Supabase database, you can easily connect Replay to your Supabase project. Replay will automatically generate the necessary code to fetch data from your Supabase database and populate the table.

Step 7: Inject Styles (Optional)#

Replay allows you to inject custom styles to match your existing design system. You can provide CSS or Tailwind CSS code, and Replay will apply it to the generated data table.

📝 Note: Replay's AI engine is constantly learning and improving. The more you use Replay, the better it will become at reconstructing complex UI elements like data tables.

Beyond Basic Tables: Handling Complex Scenarios#

Replay isn't limited to simple data tables. It can also handle more complex scenarios, such as:

  • Nested Tables: Replay can reconstruct tables within tables, accurately capturing the hierarchical relationships between data.
  • Calculated Columns: Replay can infer the logic behind calculated columns and generate the necessary code to perform the calculations.
  • Data Validation: Replay can identify data validation rules and generate code to enforce them.
  • Dynamic Filtering: Replay can reconstruct complex filtering logic, allowing users to easily filter data based on multiple criteria.
  • Multi-page applications: Replay can generate code across multiple pages, maintaining state and data flow between them. This allows for the reconstruction of complete user flows.

⚠️ Warning: The accuracy of Replay's reconstruction depends on the quality of the video recording. Make sure the video is clear, stable, and shows all the relevant user interactions.

Replay vs. Other Code Generation Tools#

While other code generation tools exist, Replay stands out due to its unique ability to analyze video and understand user behavior. This allows Replay to generate code that is more accurate, functional, and maintainable than code generated by screenshot-based tools.

Featurev0.devDhiWiseReplay
Video Input
Behavior AnalysisPartial
Multi-page GenerationLimitedLimited
Supabase Integration
Style Injection
Product Flow Maps

Frequently Asked Questions#

Is Replay free to use?#

Replay offers a free tier with limited features. Paid plans are available for users who need more advanced functionality.

How is Replay different from v0.dev?#

v0.dev primarily relies on text prompts to generate code. Replay, on the other hand, analyzes video recordings to understand user behavior and generate code that accurately reflects the intended functionality. This makes Replay particularly well-suited for reconstructing complex UI elements like data tables.

What kind of video should I upload to Replay?#

You should upload a clear and stable video recording that shows all the relevant user interactions with the data table. Make sure the video is well-lit and the UI elements are clearly visible. The video should demonstrate all the desired functionality of the table, including sorting, filtering, and pagination.

What frameworks does Replay support?#

Replay currently supports React, Vue.js, and Angular. We are constantly adding support for new frameworks.

Can Replay handle complex data validation rules?#

Yes, Replay can identify data validation rules and generate code to enforce them. However, the accuracy of the reconstruction depends on the clarity of the video recording and the complexity of the validation rules.


Ready to try behavior-driven code generation? Get started with Replay - transform any video into working code in seconds.

Ready to try Replay?

Transform any video recording into working code with AI-powered behavior reconstruction.

Launch Replay Free