Adds "read more" functionality to the wrapped content.

You can set the "read more" threshold by amount of words, paragraphs or lines. "words" and "paragraphs" count what ever fits first. If using "words" or "paragraphs", an invisible "read more" marker will be placed inside the content to indicate where the content should be toggled.

"lines" works on its own and overwrites "words" and "paragraphs". To get animation and dynamic showing of the button depending whether it is already showing everything or not, you have to set content for the slot "lines". That content has to be an exact copy of the "default" content.

The component does not update itself when you change its content. If you change the component's text, use the universal "key" attribute to trigger a reinitialization by giving the key attribute a new value.

Adds the classes "hylo-text-more-visible" and "hylo-open" when the full content is visible.

Needs a hylo-breakpoint-listener to work with the breakpoint specific properties.

Used slots:

  • default: the content
  • button: the "read more" button content
  • lines: copy of the "default" content when using countLines

Properties

buttonClass: string

Classes added to the button wrapped by the "read more" hylo-button component.

buttonLabel: string

Aria-label added to the "read more" button.

count: number = null

The amount of words the "read more" marker is set after.

countLg: number = null

The amount of words the "read more" marker is set after in lg view. Overwrites the "count" property.

countLgLines: number = null

The amount of lines after the "read more" button is placed in lg view. Overwrites any "count" or "countP" marker set and the "countLines" property.

countLgP: number = null

The amount of paragraphs the "read more" marker is set after in lg view. Overwrites the "countP" property.

countLines: number = null

The amount of lines after the "read more" button is placed. Overwrites any "count" or "countP" marker set.

countMd: number = null

The amount of words the "read more" marker is set after in md view. Overwrites the "count" property.

countMdLines: number = null

The amount of lines after the "read more" button is placed in md view. Overwrites any "count" or "countP" marker set and the "countLines" property.

countMdP: number = null

The amount of paragraphs the "read more" marker is set after in md view. Overwrites the "countP" property.

countP: number = null

The amount of paragraphs the "read more" marker is set after.

countSm: number = null

The amount of words the "read more" marker is set after in sm view. Overwrites the "count" property.

countSmLines: number = null

The amount of lines after the "read more" button is placed in sm view. Overwrites any "count" or "countP" marker set and the "countLines" property.

countSmP: number = null

The amount of paragraphs the "read more" marker is set after in sm view. Overwrites the "countP" property.

countXl: number = null

The amount of words the "read more" marker is set after in xl view. Overwrites the "count" property.

countXlLines: number = null

The amount of lines after the "read more" button is placed in xl view. Overwrites any "count" or "countP" marker set and the "countLines" property.

countXlP: number = null

The amount of paragraphs the "read more" marker is set after in xl view. Overwrites the "countP" property.

countXs: number = null

The amount of words the "read more" marker is set after in xs view. Overwrites the "count" property.

countXsLines: number = null

The amount of lines after the "read more" button is placed in xs view. Overwrites any "count" or "countP" marker set and the "countLines" property.

countXsP: number = null

The amount of paragraphs the "read more" marker is set after in xs view. Overwrites the "countP" property.

dotsClass: string

Classes added to the three dots section.

Has no influence when using "countLines".

hyloButtonClass: string

Classes added to the "read more" hylo-button component.

hyloTextMoreToggled: EventEmitter<"closed" | "open">

Emitted when the toggle button is clicked. Contains the new state.

showDots: string

If set, three dots are shown at the bottom right of the clipped area. The value is set as background color for the three dots.

Has no influence when using "countLines". With "countLines" the dots are always shown.

threshold: string | HTMLElement = null

You can define your own "read more" marker as alternative to the "count" and "countP" properties. Can be set as css query or HTMLElement.

toggleButton: boolean

If set, the "read more" button functions as a toggle button. By default the button disappears after click.

Methods

  • Show content only until "read more" marker.

    Returns Promise<void>

  • Show full content.

    Returns Promise<void>

  • Toggle between "open" and "close".

    Returns Promise<void>

Generated using TypeDoc