Promptabide Logo
MN

Minh Nguyen

@minh_nguyen7 months ago

Generating React Components That Match An Existing Codebase

Paste one of your own components as the style reference and the output stops fighting your conventions.

frontend
react
typescript
components
Keywords:
react component generation
code conventions
shadcn
Generated React is usually fine in isolation and wrong for your repo — different import style, different state library, className soup where you use cva.

The fix is one extra paragraph:

"Here is an existing component from this codebase. Match its conventions exactly: import order, how props are typed, how variants are handled, how it handles loading and empty states.

[paste one real component]

Now build: [description]"

You are not describing your conventions, you are showing them. Same reason few-shot beats instructions.

What still needs a hand edit: accessibility. It will add aria-label and stop. If you want focus management on a dialog, or a live region on an async result, ask for those by name.

Attachments (1)

Attachment
8.1k9
Comments (9)
No comments yet. Be the first to share your thoughts!
Top Contributors
Loading...
Follow PromptAbide

New bides, prompt breakdowns and community picks, on whichever feed you already read.

Trending Tags
Loading...
Generating React Components That Match An Existing Codebase | PromptAbide