Skip to main content

Create block

Have your agent write a new section that matches the blocks in your project, with the same structure, theme tokens, spacing and accessibility, for your UI library.

Usage

Describe the section and where it goes:

Prompt
/shadcnpro-create-block A pricing section with a usage slider: the price updates as you drag from 1,000 to 100,000 tracked hours. It goes under the hero on /pricing.

The agent searches the blocks first. If one is close, it installs and adapts it, which is usually less work than a new one. If nothing fits, it writes the section and tells you why no block did.

What the skill does

  1. Searches the registry for a block that already does the job.
  2. Reads your project: the UI library, the icon library and the components you have.
  3. Reads two installed blocks in full, one from the same family and one with a similar layout, as its reference for spacing, heading sizes and code style.
  4. Opens every component it plans to use and checks its exports and props.
  5. Writes one file, components/blocks/<name>.tsx.
  6. Checks it: types, lint, a search for hard-coded styling, then the block in the browser next to an installed one, and by keyboard.

What makes it match

A visitor shouldn't be able to tell which sections you installed and which one the agent wrote. So the new block follows the conventions of the others:

  • The same anatomy. A full-width <section> that owns its vertical padding, with a centered container that sets the width.
  • Theme tokens only. bg-background, text-muted-foreground, border-border and the radius and shadow scale. No bg-white, no gray scales, no hex values. That is what makes a block follow your brand and dark mode without a single dark: class.
  • Content at the top. Text and lists sit in typed constants at the top of the file, and the markup maps over them.
  • Mobile first, then sm: and md: for wider screens.
  • Accessible. Headings in order, labels on inputs, alt text on images, and a focus ring on everything you can click.
  • Your content. No lorem ipsum, and no invented customers or numbers.

If a design needs a color your theme doesn't have, the agent adds a token to your stylesheet instead of hard-coding the color.

Written for your UI library

shadcn/ui builds on Radix UI, Base UI or React Aria, and they differ in details:

Radix UIBase UIReact Aria
A button that is a linkasChildbuttonVariants() on the linkLinkButton
A custom triggerasChildrenderNested trigger
Button eventsonClickonClickonPress

The skill writes for the library in your components.json, and the component files in your project decide the details.

Where the file goes

New blocks sit next to the installed ones in components/blocks/, named by what they do, such as pricing-usage-slider.tsx. The name has no number, so it can never collide with a block from the registry.

The agent imports only what your project already has, and asks before it adds a package.