Anchor Design System

Read more3.0

The Read more component displays a link that, when clicked, expands to show more text.

Installation

npm i @tryg/ui-library

Usage

Individual only imports the desired component, and only needs to be included once within the application. Which is beneficial to keep the application size small.

Webcomponent
<script type="module">
  import { defineCustomElement } from '@tryg/ui-library/dist/components/anchor-read-more';
  defineCustomElement();
</script>
<anchor-read-more>
  <span slot="show-more">Read More</span>

  <div slot="long-text">This text will be hidden until the link is clicked.</div>
</anchor-read-more>

Global only needs to be defined once in the application, but it will import all components even the ones that are not in use..

Webcomponent
<script type="module">
  import { defineCustomElements } from '@tryg/ui-library/dist/loader';
  defineCustomElements();
</script>
<anchor-read-more>
  <span slot="show-more">Read More</span>

  <div slot="long-text">This text will be hidden until the link is clicked.</div>
</anchor-read-more>

Show less slot

Expanded

You can customize the default behavior of the anchor-read-more component by setting the expanded prop to true, which will cause the component to be expanded by default.

Emphasized

You can customize the default behavior of the anchor-read-more component by setting the expanded prop to true, which will cause the component to be expanded by default.

API

anchor-read-more

Properties

PropertyAttributeDescriptionTypeDefault
emphasizedemphasizedSet a visually emphasized statebooleanfalse
expandedexpandedWhether the read-more starts expandedbooleanfalse
uuiduuidGive this instance of read-more a custom ID, or keep the default.stringuuidv4()

Events

EventDescriptionType
toggledEvent dispatched when read-more expands or contractsCustomEvent<{ value: boolean; }>

Methods

toggleExpand() => Promise<void>

Returns

Type: Promise<void>

CSS Custom Properties

NameDescription
--read-more-border-widthSet the width of the bottom border
--read-more-font-familySet the font family of the read more text.
--read-more-font-sizeSet the font size of the read more text.
--read-more-font-weightSet the font weight of the read more text.
--read-more-icon-colorSet the color of the read more icon.
--read-more-line-heightSet the line height of the read more text.
--read-more-link-text-colorSet the text color of the read more link.
--read-more-link-text-color-hoverSet the text color of the read more link on hover.
--read-more-text-colorSet the text color of the read more content.

Dependencies

Depends on

Graph


Built with StencilJS

On this page