React Component Generator with TypeScript
Added Apr 1, 2026
About This Prompt
This prompt generates complete, production-quality React components that follow modern best practices from day one. Instead of scaffolding a basic component and gradually adding TypeScript types, accessibility, and tests, you get everything in a single output. The emphasis on ARIA attributes and keyboard navigation ensures your components are accessible by default. The included test suite covers the most important scenarios so you can ship with confidence. Ideal for teams establishing component patterns or developers who want to maintain high standards without slowing down.
Variables to Customize
[COMPONENT_NAME]
Name of the React component
Example: DataTable
[STYLING_APPROACH]
CSS methodology to use
Example: Tailwind CSS
[COMPONENT_PURPOSE]
What the component does
Example: display sortable, filterable tabular data with pagination and row selection
Tips for Best Results
- Specify your project's React version to get compatible hook patterns
- Mention your state management library if the component needs global state
- Ask for Storybook stories as a follow-up to get a visual testing setup
Example Output
```tsx
import React, { useState, useMemo, useCallback } from 'react';
/** Props for the DataTable component */
interface DataTableProps<T extends Record<string, unknown>> {
/** Array of data objects to display */
data: T[];
/** Column configuration */
columns: ColumnDef<T>[];
/** Enable row selection */
selectable?: boolean;
/** Callback when selection changes */
onSelectionChange?: (selected: T[]) => void;
}
```