Components

Page Hero

A page-level hero component designed to grab attention and provide a quick overview or key message, guiding users toward exploring the rest of the page.

Usage

The Page Hero component is ideal for drawing attention to a specific section of a page, typically at the very top, where a bold and impactful statement is needed.

Learn, code, and build with our developer community

Collaborate. Innovate. Build better solutions together.
::page-hero
---
title-tag: "h2"
title-font-size: "44px"
title-line-height: "48px"
full-width: true
background-image: 
  url: "https://i.imgur.com/rU6cP5h.jpeg"
  background-size: "cover"
background-color: "#010C32"
color: "white"
padding: "100px 20px"
text-align: "left"
---
#title
Learn, code, and build with our developer community

#description
Collaborate. Innovate. Build better solutions together.

#actions
::k-button{ size="large" to="/getting-started" }
  Get Started
::
::
PageHero Component Props

Should the main element content extend full width to the edge of the page. Accepts boolean.

The background image of the component. Accepts `BackgroundImage` interface.

The background URL. Should be an absolute or full URL.

The background image size. Accepts CSS values for background-size. Default is `auto`.

The background color of the component. Accepts string | null.

The text color of the element. Accepts string.

The padding of the component. Accepts string | null.

Aligns the text displayed in the component. Accepts values for text-align css property.

Props

titleTag

The HTML tag to use for the title.

  • Type: string
  • Default: h2

Learn, code, and build with our developer community

Collaborate. Innovate. Build better solutions together.
::page-hero
---
title-tag: "h1"
---
#title
Learn, code, and build with our developer community

#description
Collaborate. Innovate. Build better solutions together.
::

titleFontSize

The font size of the title text.

  • Type: string
  • Default: 24px

titleFontWeight

The font weight of the title text.

  • Type: string
  • Default: 700

titleLineHeight

The line-height of the title text.

  • Type: string
  • Default: 36px

descriptionFontSize

The font size of the description text.

  • Type: string
  • Default: 18px

descriptionFontWeight

The font weight of the description text.

  • Type: string
  • Default: 500

descriptionLineHeight

The line-height of the description text.

  • Type: string
  • Default: 28px

image

The image element placed in the PageHero.

Use the backgroundImage prop if you need a background for the entire PageHero component. Use the image prop if you need to place an image on top, bottom, left or right of the text block.

  • Type: Object
  • Default: undefined
interface PageHeroImage {
  /** The image position, one of 'left' | 'right' | 'top' | 'bottom'. */
  position?: PageHeroImagePosition
  /** The image source. */
  src: string
  /** The image alt text. */
  alt?: string
  /** The max width of the image in pixels or percentage. */
  maxWidth?: string
  /** The border of the image. */
  border?: string
  /** The border radius of the image. */
  borderRadius?: string
  /** The paddings of the image. */
  padding?: string
  /** The margins of the image. */
  margin?: string
  /** The image alignment inside flex parent. */
  alignSelf?: string
}

Here's an example of using PageHero with image:

The alt image text

Learn, code, and build with our developer community

Collaborate. Innovate. Build better solutions together.
::page-hero
---
padding: "20px"
border: "1px solid gray"
image: 
  src: "https://i.imgur.com/rU6cP5h.jpeg"
  alt: "The alt image text"
  max-width: "200px"
  border: "1px solid gray"
  border-radius: "8px"
  padding: "6px"
  margin: "8px"
  align-self: "center"
  position: "top"
---
#title
Learn, code, and build with our developer community

#description
Collaborate. Innovate. Build better solutions together.
::
PageHero Component Props
Adds image to the hero. Accepts PageHeroImage object.

The image position, one of 'left' | 'right' | 'top' | 'bottom'.

The image source.

The image alt text.

The max width of the image in pixels or percentage.

The border of the image.

The border radius of the image.

The paddings of the image.

The margins of the image.

The image alignment inside flex parent.

Shared Props

This component also includes the shared props listed below:

  • textAlign - default is left.
  • verticalAlign - default is center.
  • horizontalAlign - default is center.
  • border - default is null.
  • borderRadius - default is null.
  • backgroundColor - default is ''.
  • color - default is ''.
  • fullWidth - default is false.
  • maxWidth - default is 100%.
  • margin - default is 0.
  • padding - default is 0.
  • backgroundImage - default is undefined.
  • styles - default is ''.

See here for more information on shared props.

Slots

actions

Use the #actions slot to add content at the bottom of the Page Hero component.

Learn, code, and build with our developer community

Collaborate. Innovate. Build better solutions together.
::page-hero
#actions
:::k-button{ size="large" to="/getting-started" }
Get Started
:::
::

description

Use the #description slot to add description content to the Page Hero component.

Learn, code, and build with our developer community

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
::page-hero
#description
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
::

tagline

Use the #tagline slot to add content above the title of the Page Hero component.

This is a badge

Learn, code, and build with our developer community

Collaborate. Innovate. Build better solutions together.
::page-hero
#tagline
This is a badge
::

title

Use the #title slot to add title content to the Page Hero component.

Learn, code, and build with our developer community

Collaborate. Innovate. Build better solutions together.
::page-hero
#title
Learn, [code](/){style="color: blue;"}, and build with our developer community
::