DlHero

Present a prominent page hero with title, lead and CTA

The DlHero block component renders a prominent hero section with a title, lead text, optional content, and a call-to-action (CTA). It integrates with your theme via utilities and exposes named slots for fine-grained control.

Features

  • đź§­ opinionated layout with grid-based positioning
  • 🏷️ named slots for title, lead, and content
  • đź”— configurable CTA as link or button
  • 🖼️ optional logo image
  • đź§© theme-friendly visual adjustments

Usage

Use ::dl-hero as a block component with content through the named slots. Set the CTA via props.

::dl-hero{cta-link="/docs/getting-started" cta-label="Get Started"}#titleBuild with confidence#leadOpinionated docs hero that stays consistent across the app.#contentUse slots to inject inline components and additional context.::

Result:

Build with confidence

Opinionated docs hero that stays consistent across the app
Use slots to inject inline components and additional context.
Get Started

With a button as CTA

Switch the CTA to a button by setting cta-type="button".

::dl-hero{cta-link="/docs/getting-started" cta-label="Read the Docs" cta-type="button"}#titleBuild with confidence#leadOpinionated docs hero that stays consistent across the app::

Result:

Build with confidence

Opinionated docs hero that stays consistent across the app

Without a CTA

Simply set cta-type to false to disable the CTA.

::dl-hero{cta-type=false}#titleBuild with confidence::

With a logo image

To display a logo image (or any other image) in the hero section, set the logo-path prop to the image's path in the public directory. You can manage its style using the #ui slot.

::dl-hero{logo-path="/logo.webp"}#titleBuild with confidence#ui{ "logo": "w-40" }::

Result:

DocLayer Logo

Build with confidence

Props

Here are the properties you can use with the DlHero component. Each property should be set on an individual component instance; they do not affect the global configuration. More about defining properties in MDC components you can read here.

nametypedefaultdescription
lazybooleanundefined

Whether to lazy load the component.

ctaType

'link'
'button'
false

'link'

Determines whether the CTA renders as a text link or a button.

ctaLinkstringundefined

Destination URL for the CTA.

ctaLabelstringundefined

Label displayed for the CTA.

logoPath'/${string}'undefined

Path to the logo image, located in the public directory.

Slots

namedescription
title

Title slot. Use plain text or Markdown.

lead

Lead slot, short descriptive text under the title.

content

Additional content under the lead. Supports inline components.

ui

Dedicated slot for defining the component’s ui object. More about styling MDC components you can read here.

Styling

Styling from Markdown

Every DocLayer component can be styled directly within your Markdown file using dedicated slot/property configuration. This allows you to customize the appearance of the component's markup elements without modifying global styles. More about components styling you can read here.

Below you'll find the default set of Tailwind classes for the component's dedicated markup elements.

<script lang="ts">const ui = defineDoclayerComponentUi({  base: [    'uc-hero-height',    'uc-hero-background',    'grid',    'grid-cols-12',    'relative',    'w-full',    'justify-center',    'items-center',    'overflow-hidden',    'text-center',  ],  logo: ['flex', 'items-center', 'mx-auto', 'w-20', 'mb-10'],  title: ['uc-hero-title-size!', 'u-text-weight-black', 'u-heading-gradient!'],  lead: ['uc-hero-lead-size', 'u-space-my', 'u-text-weight-default'],  content: ['u-space-mb'],  link: ['inline-block'],  button: [    'uc-hero-button-size!',    'u-space-my',    'u-space-px2',    'u-text-weight-bold',    'inline-block',    'relative',    'z-5',    'uppercase',    'align-baseline',    'transition-all',  ],});</script>

CSS Variables

Here is a set of CSS variables you can use to customize the appearance of the DlHero component globally. More about theming and styling with CSS variables, you can read here.

@theme {  --app-hero-height: 50rem;  --app-hero-height-mobile: calc(80vh - var(--app-layout-header-height));  --app-hero-title-size: 4.5rem;  --app-hero-title-mobile-size: 2.5rem;  --app-hero-title-line-height: 5rem;  --app-hero-title-mobile-line-height: 3rem;  --app-hero-lead-size: 1.3rem;  --app-hero-lead-mobile-size: 1.1rem;  --app-hero-button-text-size: 1.25rem;  --app-hero-button-line-height: 2.25rem;  --app-hero-button-height: 4.5rem;  --app-hero-button-font-weight: var(--app-text-weight-black);  --app-hero-bg-grid-line-size: 50px;  --app-hero-bg-grid-line-gap: 48px;  --app-hero-bg-grid-line-01: light-dark(      rgb(var(--app-color-gray-rgb-rev) / 0.1),      rgb(var(--app-color-gray-rgb-rev) / 0.2)    )    var(--app-hero-bg-grid-line-size);  --app-hero-bg-grid-line-02: light-dark(      rgb(var(--app-color-gray-rgb-rev) / 0.1),      rgb(var(--app-color-gray-rgb-rev) / 0.2)    )    var(--app-hero-bg-grid-line-size);}

CSS Utilities

Below are the CSS utility classes used by the DlHero component. They make use of the CSS variables described above and define the default styling for the component's markup elements.

@utility uc-hero-background {  &::before {    @apply content-['']     uc-hero-background-grid     absolute top-0 left-0 right-0 bottom-0 z-[-1] origin-bottom    opacity-80 pointer-events-none     transform scale-110;  }}@utility uc-hero-background-grid {  /* instead of TW classes, pure CSS notation is used for better readability */  background:    repeating-linear-gradient(      to right,      transparent,      transparent var(--app-hero-bg-grid-line-gap),      var(--app-hero-bg-grid-line-01),      var(--app-hero-bg-grid-line-02)    ),    repeating-linear-gradient(      to bottom,      transparent,      transparent var(--app-hero-bg-grid-line-gap),      var(--app-hero-bg-grid-line-01),      var(--app-hero-bg-grid-line-02)    );  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);}@utility uc-hero-height {  @apply min-h-(--app-hero-height-mobile) md:min-h-(--app-hero-height);}@utility uc-hero-title-size {  @apply text-(length:--app-hero-title-mobile-size) md:text-(length:--app-hero-title-size)         leading-(length:--app-hero-title-mobile-line-height) md:leading-(length:--app-hero-title-line-height);}@utility uc-hero-lead-size {  @apply text-(length:--app-hero-lead-mobile-size) md:text-(length:--app-hero-lead-size) leading-8;}@utility uc-hero-button-size {  @apply text-(length:--app-hero-button-text-size)         leading-(length:--app-hero-button-line-height)         font-(--app-hero-button-font-weight)         h-(length:--app-hero-button-height);}

Accessibility

Ensure your title and lead provide a clear and concise message. If you want a stronger emphasis on the hero section, consider using CTA as a button that should be easily identifiable and actionable.