HeroHeading
StableA big centered headline that types itself out once, then stays still.
Also known as hero, headline, welcome heading
Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.
Typed
<HeroHeading text="What can I help you with?" />The default. The text types out when the page opens and whenever the text changes.
When to use it
The big greeting on an empty chat. It types itself out once and then stays still, so the empty screen feels alive without moving forever.
Use it for
- The opening line of an empty chat.
- A greeting on a start page: turn typing off if people see it on every visit.
Not for
- Naming a group of items in a list: use SectionLabel.
- Titles inside cards or sections.
Do and avoid
3 paid, 1 waiting
Do
- Use it once per screen, as the opening line of an empty chat.
- Keep it to one short sentence so it fits on two lines on a phone.
- Turn typing off when it would replay on every visit.
- Speak to the person in a single sentence.
Avoid
- Do not use it for section titles or inside cards.
- Do not change the text quickly. Each change types out again.
- Do not add another moving element next to it.
- Do not make screen readers announce it again. They already get the full sentence.
On a phone
- The heading is centred and balanced, and it is smaller below the sm breakpoint so it wraps on a phone.
- Text is typed in letter by letter, and only the typed part is drawn, so on a narrow screen the heading grows taller line by line as it types. Reserve space for it if the content below should not move.
- Under reduced motion it shows all at once.
Properties
| Prop | Type | Default | Description |
|---|---|---|---|
| textrequired | string | none | The headline. Changing it restarts the typing animation. |
| type | boolean | true | When false, the whole text renders at once with no animation. |
"Show code under the preview gives the code for the example on the stage."
States
States this part has beyond its default look. Build each one your screen can reach. States set by a property are in the Code tab.
- typing
- Pass type (on by default) to reveal the text one character at a time; it shows in full at once when the user prefers reduced motion.
Tokens
Change one of these and every part that uses it follows.
--fg--font-serif
Built in
- Screen readers hear the whole sentence at once, not each letter as it types.
- People who turn off motion see the full text right away.
- It is a second-level heading.
What you need to do
- Check that a second-level heading fits your page outline. It is always one.
Built toward WCAG 2.2 AA and checked automatically; no independent audit yet. Read the accessibility guide