Calm motion: animations on this site only fade, with no movement
Spoiler
Text hidden under a blur until a click shows it
Hides a plot twist or an answer until the reader asks for it. It works for a few words in a line or for a whole block. To hide long text for space and not for surprise, use read more.
Basic
Episode 41 starts slow, but the last ten minutes are worth it: , and the room goes quiet.
- Put the hidden text in the default slot. While it is hidden, the words are a blur on a gray band, and the reader cannot select them.
- A click, Enter, or Space shows the text. It stays shown.
v-model:shownreads or sets the state. blockmakes a block with a visible "Show the spoiler" badge, for a paragraph or more. Without it, the spoiler sits in a line of text.hintsays what the text is about, for example "the end of episode 41". The button adds it to its name.- While the text is hidden, screen readers and the keyboard cannot reach it, so it is not read aloud by accident. After the reveal, the focus goes to the text. Change the words with
labelsor a label pack:show, andshowAbout(a function of the hint).
Usage
ts
import { BlessSpoiler } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
hint | string | — | what the hidden text is about, for example "the end of episode 41" |
block | boolean | — | a block of text in place of a few words in a line |
labels | Partial<{ show: string; showAbout: (hint: string) => string; }> | — | |
shown | boolean | false | the text shows |
Events
| Name | Payload | Description |
|---|---|---|
update:shown | [value: boolean] |
Slots
| Name | Scope | Description |
|---|---|---|
default | — |