Hero

Use the hero component to render a full-width banner at the top of a page.

import {Hero} from '@primer/react-brand'

Examples

Default

Loading

Images

Hero can display an optional foreground image. Use position to alternate between various layouts.

Loading

GridLine variant

Use variant="gridline" to display the Hero with a contained image, subtle background color, and borders.

The GridLine variants all feature a trailing border by default. Use Box if you need to add one to the top also.

Loading

GridLine “Expressive” variant

Use variant="gridline-expressive" for an alternative split-content layout.

The GridLine variants all feature a trailing border by default. Use Box if you need to add one to the top also.

Loading

Video

Hero includes support for inserting videos.

Use VideoPlayer, a native <video> element or a YouTube embed as valid children. Similarly to Hero.Image, use the position prop to alternate between various layouts.

Loading

Alignment

Hero text alignment can be adjusted by changing the align prop.

Loading

Component props

Hero

NameTypeDefaultDescription
align'center', 'start''start'Optional text alignment
variant'default'
'gridline'
'default'Visual variants to the Hero.
enableAnimationbooleanfalseEnables animations for variants and children that support them.
classNamestringSets a custom class on the root element
refReact.RefObjectForward a Ref to the underlying DOM node

Hero.Label

nametypedefaultdescription
variant'default'
'muted'
'muted'Specify alternative text appearance
classNamestringSets a custom class on the root of the label
idstringSets a custom id on the root of the label
refReact.RefObjectForward a Ref to the underlying DOM node

Hero.Heading

nametypedefaultdescription
classNamestringSets a custom class on the root element
idstringSets a custom id
refReact.RefObjectForward a Ref to the underlying DOM node

Forwards all props from the Heading component, including as, size, and weight.

Hero.Description

nametypedefaultdescription
classNamestringSets a custom CSS class
variant'default'
'muted'
'default'Specify alternative text appearance

Forwards size and weight props from the Text component.

Hero.PrimaryAction

nametypedefaultdescription
classNamestringPrimary link custom class
hrefstringhref for primary link
asa, buttonaApplies the underlying HTML element

Forwards all props from the Button component.

Hero.SecondaryAction

nametypedefaultdescription
classNamestringSecondary link custom class
hrefstringhref for secondary link
asa, buttonaApplies the underlying HTML element

Forwards all props from the Button component.

Hero.Image

nametypedefaultdescription
position'block-end'
'block-end-padded'
'inline-end'
'inline-end-padded'
'inline-start'
'inline-start-padded'
'block-end'Controls positioning of the foreground image

Forwards all props from the Image component, including src, alt, and aspectRatio.

Hero.Video

nametypedefaultdescription
position'block-end'
'block-end-padded'
'inline-end'
'inline-end-padded'
'inline-start'
'inline-start-padded'
'block-end'Controls positioning of the child video element
posterstringURL of the poster image to display before video plays. When set, posterAltText and posterTitle are required
posterAltTextstringAlt text for the poster image. Required when poster is set
posterTitlestringTitle text displayed on the poster overlay. Required when poster is set