vercel-labs / vercel-labs/json-render

Support className prop on shadcn components

Open
#145 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
16.8k
Forks
901
Avg merge
3h 14m
Merged PRs (30d)
4

Description

The shadcn components don't accept a className prop, so there's no way to override or extend their styling from the spec.

For example, the Card component wraps children in <CardContent className="flex flex-col gap-3">. That forced gap-3 breaks compact layouts like stat cards — but there's no escape hatch to override it without creating a full custom component.

Suggestion

Add an optional className: z.string().nullable() to each shadcn component's props schema and forward it to the root element via cn():

// catalog.ts
Card: {
  props: z.object({
    // ...existing props
    className: z.string().nullable(),
  }),
}

// components.tsx
Card: ({ props, children }) => (
  <Card className={cn(existingClasses, props.className)}>
    ...
  </Card>
)

This matches how shadcn/ui itself works — every component accepts className. It would let users fine-tune layout without needing to rewrite entire components.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing catalog.ts and components.tsx to identify each shadcn component's props schema and root element. Add the nullable className prop and forward it through cn() for every component; done means users can override or extend each component's existing styling without rewriting it.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.