Toggle link

Updated at:

Introduction

A toggle link component is a user interface element that allows users to switch between different views or content.

Configurations

Category

Configuration

Example

Description

Default value

The value of the toggle link component. The parameter is true or false.

Text content

The content of the toggle link component.

Enable badge

Specifies whether to display a badge.

Badge configuration

After you enable the badge, you can configure its properties.

Tooltip

Specifies whether to display a tooltip.

Tooltip configuration

After you enable the tooltip, you can configure its properties.

Icon mode

When the Show icon configuration is enabled, you can select an icon mode.

Fixed icon

A fixed set of three icons.

Custom icon

The icon to display when the value of the toggle link component is true or false.

Interaction

Hide

Controls the default display state of the toggle link component. If this parameter is set to true, the component is hidden. For more information, see Common properties.

Disable

Controls the disabled state of the toggle link component.

Style

Height

The height of the component. For more information, see Common properties.

Margin

For more information, see Common properties.

Icon position

The position of the icon, which can be left or right.

Underline

Specifies when the underline appears.

Font size

The font size of the link text.

Line height

The line-height property defines the vertical spacing between lines of text.

Font weight

The font-weight property specifies the thickness of the text.

Overflow control

The display effect when the text content overflows.

Overflow hidden style

The style effect when the overflowing text is hidden.

Text wrap

Specifies whether the text is displayed on a single line.

Word break

Specifies how to handle word break points in multiline text.

Horizontal alignment

The horizontal alignment of the link text.

Vertical alignment

The vertical alignment of the link text.

Text transform

Transforms the link text to all uppercase or all lowercase. You can also transform each word individually.

CSS style

Text color

The color of the link text.

Text shadow

The text-shadow property adds shadow effects to the text of an element. You can set multiple shadow effects on the same element and separate them with commas. The values for this property include the shadow's x-axis offset, y-axis offset, blur radius, spread radius, and color. For more information, see the text-shadow property.

Border

The border of the text content part of the toggle link component. For more information, see Common properties.

Border radius

The border radius of the text content part of the toggle link component. For more information, see Common properties.

Padding

The padding of the text content part of the toggle link component. For more information, see Common properties.

Properties and methods

Name

Type

Example

Description

value

boolean

toggleLink1.value

The current value of the toggle link component.

text

string

toggleLink1.text

The current content of the toggle link component.

setValue

func

toggleLink1.setText(true)

Sets the value of the toggle link to true.

clearValue

func

toggleLink1.clearValue()

Clears the value of the toggle link.

setText

func

toggleLink1.setText('Link')

Sets the link text content to Link.

clearText

func

toggleLink1.clearText()

Clears the link text content.

Event callbacks

Configuration

Description

The event that is triggered when the link text is clicked.

Scenario examples

  • Expand and collapse document scenario
    • The first part is the title and the toggle link.

    • The second part is the text content. When the toggle link is clicked, a click event controls the visibility of the text component.

      image