# Marketing Hero Section: With Code Preview

A hero pairing a headline and CTA with a syntax highlighted code snippet. Speaks directly to developers at the top of a tool or library landing page.

- Page: https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-code-preview
- Collection: [Marketing](https://www.shadcn-ui-blocks.com/blocks/marketing), Free tier
- Group: [Hero Sections](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections)
- Created: 2026-06-14
- Preview image: https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-code-preview.png

## Install

```bash
npx shadcn@latest add @shadcn-ui-blocks/marketing-hero-sections-with-code-preview
```

A free block: it installs with no account or key. Or install it by URL: `npx shadcn@latest add "https://www.shadcn-ui-blocks.com/r/marketing-hero-sections-with-code-preview.json"`.

## Depends on

- npm packages: class-variance-authority, radix-ui
- shadcn/ui components: badge, button, card
- Installs to: `@/components/blocks/marketing/hero-sections/with-code-preview`

## About this block

With Code Preview is a two-column hero. The left column holds a small
outline badge, a bold headline, a short paragraph of supporting copy, and
two action buttons stacked in a row. Below those buttons sits an inline
code snippet in a muted rounded panel showing a quick install command.
The right column contains a terminal window card with a macOS-style
traffic-light header, a sequence of shell commands, and their output lines.
A smaller floating code card is anchored to the lower-right corner of that
terminal, showing a short component import and usage snippet.

The two columns, the badge text, the headline, the supporting copy, and
the button labels are all independent. You can swap the install command in
the inline panel, rewrite the terminal steps, and replace the floating code
card with a different file without touching layout or spacing. Both cards
share the same card and muted surface tokens, so the colour scheme updates
automatically with the site theme.

## When to use

Reach for this block when your product is a tool, library, or SDK that
developers set up from a terminal. The terminal window and floating code
card immediately signal that the product is code-first, which earns trust
faster than a screenshot would. For a project management workspace that
exposes an API or CLI, this layout lets you show the setup flow right at
the top of the page without any extra scrolling.

A natural flow around it on a Marketing (Legacy) page:

**Before**

- [Announcement Banners](https://www.shadcn-ui-blocks.com/blocks/marketing/announcement-banners) to surface
  a new release or beta invite above the fold
- A plain site navigation bar to orient visitors before they reach the hero

**After**

- [Feature Sections](https://www.shadcn-ui-blocks.com/blocks/marketing/feature-sections) to detail what
  the tool does after visitors have seen the install path
- [Testimonials](https://www.shadcn-ui-blocks.com/blocks/marketing/testimonials) to back up the pitch with
  quotes from developers already using the product

## What you can customize

The block has two distinct visual zones you can adapt independently:

- **Left column copy.** Swap the badge label, headline, and paragraph to
  match your product name and value statement without affecting either card.
- **Terminal card steps.** Replace the scaffold commands with your own init
  or login sequence so the output lines reflect the real setup experience.
- **Floating code card.** Point the file name and code snippet at any file
  in your codebase to highlight the API surface visitors will use most.

> Tip: keep the terminal output to four or five lines so the two cards sit
> comfortably side by side without the layout growing too tall on mobile.

## More in Marketing Hero Sections

- [3D Isometric Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/3d-isometric-hero)
- [Animated Features Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/animated-features-hero)
- [Animated Gradient](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/animated-gradient)
- [Animated Text Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/animated-text-hero)
- [Centred With Image](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/centred-with-image)
- [Chat Preview Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/chat-preview-hero)
- [Countdown Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/countdown-hero)
- [Gradient Background](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/gradient-background)
- [Gradient Mesh Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/gradient-mesh-hero)
- [Image Carousel Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/image-carousel-hero)
- [Image With Reviews](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/image-with-reviews)
- [Interactive Metrics](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/interactive-metrics)
- [Mobile App Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/mobile-app-hero)
- [Multi-Step CTA Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/multi-step-cta-hero)
- [Particles Background Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/particles-background-hero)
- [Product Carousel Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/product-carousel-hero)
- [Progress Tracker Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/progress-tracker-hero)
- [Search Bar](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/search-bar)
- [Simple Centred](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/simple-centred)
- [Social Proof Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/social-proof-hero)
- [Split Content Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/split-content-hero)
- [Split Image Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/split-image-hero)
- [Split With Video](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/split-with-video)
- [Testimonial Carousel](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/testimonial-carousel)
- [Trust Indicators](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/trust-indicators)
- [Video Background Hero](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/video-background-hero)
- [With 3D Mockup](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-3d-mockup)
- [With API Preview](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-api-preview)
- [With App Showcase](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-app-showcase)
- [With Bento Grid](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-bento-grid)
- [With Content Tabs](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-content-tabs)
- [With Dashboard](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-dashboard)
- [With Email Input](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-email-input)
- [With Feature Cards](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-feature-cards)
- [With Feature Timeline](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-feature-timeline)
- [With Integration Showcase](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-integration-showcase)
- [With Product Screenshots](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-product-screenshots)
- [With Team Grid](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-team-grid)
- [With Terminal](https://www.shadcn-ui-blocks.com/blocks/marketing/hero-sections/with-terminal)
