v1.4.0
  1. Home
  2. Get started
  3. Foundations
  4. Patterns
    1. Accordion
    2. Autocomplete
    3. Button
    4. Callout
    5. Chat
    6. Description List
    7. Details
    8. Expand Text
    9. Fallback Image
    10. Feedback
    11. Focus Indicator
    12. Footer
    13. Header
    14. Hero
    15. IIIF Image
    16. Link
    17. Page Title
    18. Results per Page
    19. Service Switcher
  5. What's new

Hero

Place your most important content in a prominent space, often at the top of your website.

Draw attention to your main content.

When to use

Use a hero when you want users to immediately understand what your website offers.

How to use

Show what makes your website unique. Help users quickly decide if they're in the right place and to encourage exploration. Use clear language that your users will recognize. Avoid jargon and technical terms.

Size your images for all screens. Use art direction to display the right image for each screen size.

Choose the right placement. While heroes are often used at the top with the header, you can place them anywhere you need to highlight important content.

Use art direction

<pennlibs-hero>
  <!-- use <picture>, <source>, and <img> elements for hero art direction -->
  <picture hero="art-direction">
    <source srcset="https://upenn-library-digital-collections.netlify.app/img/collection-10.jpg" media="(min-width: 600px)" />
    <img src="https://upenn-library-digital-collections.netlify.app/img/collection-9.jpg" alt="" />
  </picture>
</pennlibs-hero>

Add a heading

<pennlibs-hero>
  <picture hero="art-direction">
    <source srcset="https://upenn-library-digital-collections.netlify.app/img/collection-10.jpg" media="(min-width: 600px)" />
    <img src="https://upenn-library-digital-collections.netlify.app/img/collection-9.jpg" alt="" />
  </picture>

  <!-- add a heading and sub heading -->
  <h1 hero="heading">Boys wearing sailor suits, playing music to a dancing turtle</h1>
  <p hero="sub-heading"><a href="/">Arnold and Deanne Kaplan Collection</a> of Early American Judaica</p>
</pennlibs-hero>

Combine with other elements

<pennlibs-hero>
  <picture hero="art-direction">
    <source srcset="https://upenn-library-digital-collections.netlify.app/img/collection-10.jpg" media="(min-width: 600px)" />
    <img src="https://upenn-library-digital-collections.netlify.app/img/collection-9.jpg" alt="" />
  </picture>

  <!-- use attribute slot="start" to place another element at the top of the hero -->
  <pennlibs-header service-name="Website Name" theme="dark" slot="start"></pennlibs-header>
</pennlibs-hero>

Slots

Slot Description
start Content to display at the start (top) of the hero.

Custom properties

Name Description
--pl-viewport-margins-max-width The maximum width of the hero inner content.
--pl-viewport-margins-gutter The gutter width of the hero inner content.

Design System

Get started Content & writing v1.4.0