react-component-generator
Skill3 starsChanged 9 months agoMITView on GitHub
Generate modern React components with TypeScript, hooks, and accessibility. Use when asked to create React components, UI components, scaffold frontend elements, or build reusable UI.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- nek1987/auto-agent-harnesstheir own version, first seen Oct 11, 2026
- OneWave-AI/claude-skillstheir own version, first seen Sep 21, 2026
- Nikoxkx/Agent-Skillstheir own version, first seen Jun 8, 2026
- jsrockstaranks/claude-skillstheir own version, first seen Jun 8, 2026
- ehtbanton/ClaudeSkillsRepotheir own version, first seen Dec 17, 2025
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- OneWave-AI/claude-skills★ 378same name
- nek1987/auto-agent-harness★ 4same name
- jsrockstaranks/claude-skills★ 1same name
- Nikoxkx/Agent-Skills★ 1same name
- ehtbanton/ClaudeSkillsRepo★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- ai-integration-generatorSkill
- api-docs-generatorSkill
- auth-scaffoldSkill
- code-reviewerSkill
- db-seed-generatorSkill
- env-config-validatorSkill
- error-boundary-generatorSkill
- git-commit-composerSkill
- nextjs-middleware-generatorSkill
- nextjs-route-generatorSkill
- prisma-migration-reviewerSkill
- prisma-query-optimizerSkill
- test-generatorSkill
- typescript-refactorerSkill
- zod-schema-generatorSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Before generating any output, read config/defaults.md and adapt all patterns, imports, and code examples to the user's configured stack.
- Distinctive: line 14
Create functional component with hooks
- Very specific: line 355
After generating a component, verify completeness: does it export a TypeScript props interface?
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
React Component Generator
Before generating any output, read config/defaults.md and adapt all patterns, imports, and code examples to the user's configured stack.
Generation Process
- Determine component type and requirements
- Generate TypeScript props interface
- Create functional component with hooks
- Add accessibility attributes
- Include keyboard navigation where applicable
Component Types
Data Display Component
interface DataTableProps<T> {
data: T[];
columns: ColumnDef<T>[];
onRowClick?: (item: T) => void;
loading?: boolean;
emptyMessage?: string;
}
function DataTable<T extends { id: string | number }>({
data,
columns,
onRowClick,
loading = false,
emptyMessage = 'No data available',
}: DataTableProps<T>) {
if (loading) {
return <div role="status" aria-busy="true">Loading...</div>;
}
if (data.length === 0) {
return <div role="status">{emptyMessage}</div>;
}
return (
<table role="grid" aria-rowcount={data.length}>
<thead>
<tr>
{columns.map((col) => (
<th key={col.key} scope="col">{col.header}</th>
))}
</tr>
</thead>
<tbody>
{data.map((item, index) => (
<tr
key={item.id}
onClick={() => onRowClick?.(item)}
onKeyDown={(e) => e.key === 'Enter' && onRowClick?.(item)}
tabIndex={onRowClick ? 0 : undefined}
role={onRowClick ? 'button' : undefined}
aria-rowindex={index + 1}
>
{columns.map((col) => (
<td key={col.key}>{col.render(item)}</td>
))}
</tr>
))}
</tbody>
</table>
);
}Form Component
interface FormFieldProps {
label: string;
name: string;
type?: 'text' | 'email' | 'password' | 'number';
value: string;
onChange: (value: string) => void;
error?: string;
required?: boolean;
disabled?: boolean;
placeholder?: string;
}
function FormField({
label,
name,
type = 'text',
value,
onChange,
error,
required = false,
disabled = false,
placeholder,
}: FormFieldProps) {
const id = `field-${name}`;
const errorId = `${id}-error`;
return (
<div className="form-field">
<label htmlFor={id}>
{label}
{required && <span aria-hidden="true"> *</span>}
</label>
<input
id={id}
name={name}
type={type}
value={value}
onChange={(e) => onChange(e.target.value)}
disabled={disabled}
placeholder={placeholder}
required={required}
aria-required={required}
aria-invalid={!!error}
aria-describedby={error ? errorId : undefined}
/>
{error && (
<span id={errorId} role="alert" className="error">
{error}
</span>
)}
</div>
);
}Modal/Dialog Component
interface ModalProps {
open: boolean;
onClose: () => void;
title: string;
children: React.ReactNode;
actions?: React.ReactNode;
}
function Modal({ open, onClose, title, children, actions }: ModalProps) {
const modalRef = useRef<HTMLDivElement>(null);
const previousFocus = useRef<HTMLElement | null>(null);
useEffect(() => {
if (open) {
previousFocus.current = document.activeElement as HTMLElement;
modalRef.current?.focus();
} else {
previousFocus.current?.focus();
}
}, [open]);
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Escape' && open) {
onClose();
}
};
document.addEventListener('keydown', handleKeyDown);
return () => document.removeEventListener('keydown', handleKeyDown);
}, [open, onClose]);
if (!open) return null;
return (
<div className="modal-overlay" onClick={onClose}>
<div
ref={modalRef}
role="dialog"
aria-modal="true"
aria-labelledby="modal-title"
className="modal"
onClick={(e) => e.stopPropagation()}
tabIndex={-1}
>
<header>
<h2 id="modal-title">{title}</h2>
<button
onClick={onClose}
aria-label="Close dialog"
className="close-button"
>
×
</button>
</header>
<div className="modal-content">{children}</div>
{actions && <footer className="modal-actions">{actions}</footer>}
</div>
</div>
);
}Layout Component
interface PageLayoutProps {
children: React.ReactNode;
sidebar?: React.ReactNode;
header?: React.ReactNode;
footer?: React.ReactNode;
}
function PageLayout({ children, sidebar, header, footer }: PageLayoutProps) {
return (
<div className="page-layout">
{header && <header role="banner">{header}</header>}
<div className="page-body">
{sidebar && <aside role="complementary">{sidebar}</aside>}
<main role="main">{children}</main>
</div>
{footer && <footer role="contentinfo">{footer}</footer>}
</div>
);
}Button Component
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'primary' | 'secondary' | 'danger' | 'ghost';
size?: 'sm' | 'md' | 'lg';
loading?: boolean;
leftIcon?: React.ReactNode;
rightIcon?: React.ReactNode;
}
const Button = forwardRef<HTMLButtonElement, ButtonProps>(
(
{
variant = 'primary',
size = 'md',
loading = false,
leftIcon,
rightIcon,
disabled,
children,
className,
...props
},
ref
) => {
return (
<button
ref={ref}
className={`btn btn-${variant} btn-${size} ${className ?? ''}`}
disabled={disabled || loading}
aria-busy={loading}
{...props}
>
{loading ? (
<span aria-hidden="true" className="spinner" />
) : (
leftIcon
)}
<span>{children}</span>
{!loading && rightIcon}
</button>
);
}
);
Button.displayName = 'Button';Composable Patterns
Compound Components
interface SelectContextValue {
value: string;
onChange: (value: string) => void;
}
const SelectContext = createContext<SelectContextValue | null>(null);
function Select({ value, onChange, children }: {
value: string;
onChange: (value: string) => void;
children: React.ReactNode;
}) {
return (
<SelectContext.Provider value={{ value, onChange }}>
<div role="listbox">{children}</div>
</SelectContext.Provider>
);
}
function Option({ value, children }: { value: string; children: React.ReactNode }) {
const ctx = useContext(SelectContext);
if (!ctx) throw new Error('Option must be used within Select');
const selected = ctx.value === value;
return (
<div
role="option"
aria-selected={selected}
onClick={() => ctx.onChange(value)}
onKeyDown={(e) => e.key === 'Enter' && ctx.onChange(value)}
tabIndex={0}
>
{children}
</div>
);
}
Select.Option = Option;Render Props
interface ToggleRenderProps {
on: boolean;
toggle: () => void;
setOn: () => void;
setOff: () => void;
}
interface ToggleProps {
initialOn?: boolean;
children: (props: ToggleRenderProps) => React.ReactNode;
}
function Toggle({ initialOn = false, children }: ToggleProps) {
const [on, setOn] = useState(initialOn);
const renderProps: ToggleRenderProps = {
on,
toggle: () => setOn((prev) => !prev),
setOn: () => setOn(true),
setOff: () => setOn(false),
};
return <>{children(renderProps)}</>;
}Accessibility Checklist
- Semantic HTML elements (button, nav, main, etc.)
- ARIA roles where semantic HTML insufficient
- aria-label or aria-labelledby for non-text content
- aria-describedby for error messages
- Focus management (modals, dynamic content)
- Keyboard navigation (Enter, Escape, Arrow keys)
- Visible focus indicators
- Color contrast (don't rely on color alone)
- Loading states announced (aria-busy, role="status")
- Error states announced (role="alert")
Completeness Check
After generating a component, verify completeness: does it export a TypeScript props interface? Does it handle the loading/error/empty states if it fetches data? Do interactive elements have keyboard handlers and aria attributes? If any check fails, fix the component before delivering.
Asset
See assets/component-template/Component.tsx for a minimal starter template.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

