Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Display

Typewriter <pm-typewriter>

Typewriter: types a phrase, holds it, deletes it and types the next one, for the changing word in a headline.

Full screen

Build apps that are

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/typewriter'; </script> <p class="pm-text-2xl"> Build apps that are <pm-typewriter words="fast|accessible|themeable|yours"></pm-typewriter> </p>

Overview

It is inline text: put it inside a heading or a sentence. Screen readers get all the phrases once, as plain text (or label), not letter by letter. It starts with the first phrase in full, waits while it is off screen, and with reduced motion (the system setting, or motion="none" / "reduced") it shows the first phrase and stays still. Between phrases only the letters that differ are retyped.

Attributes

AttributeTypeDefaultDescription
wordsstring[][]The phrases: words="fast|accessible|yours", a JSON array, or an array as a property.
speednumber70Milliseconds per typed letter (default 70).
delete-speed
prop: deleteSpeed
number35Milliseconds per deleted letter (default 35).
holdnumber1800How long a finished phrase stays, in milliseconds (default 1800).
oncebooleanfalseStop at the last phrase instead of starting over.
pausedbooleanfalseStopped. Set it, or call stop() and play().
no-cursor
prop: noCursor
booleanfalseHide the cursor.
labelstring—Text for screen readers instead of the list of phrases.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-changeonPmChangeA phrase was typed in full.
pm-finishonPmFinishWith once: the last phrase was typed.

CSS parts

PartDescription
::part(cursor)The blinking cursor.

Methods

stop(), play()

Used in templates

Landing page