Skip to content

Tertiary button

<tpg-tertiary-button></tpg-tertiary-button>

Tertiary Button are medium-low emphasis buttons used to communicate a tertiary action the users can take. They are typically placed in Forms where users can take non-tertiary workflow related actions.

Component behavior

The tertiary button will respond to click inside the entirety of its area while not disabled, or from “Enter” and “Space” keys while having k-focus.

Examples

Label

Use the label attribute to set the label of the button.

Size

You can control the Tertiary Button’s size using the size attribute

Disabled

You can disable the Tertiary Button with the disabled attribute.

Custom width

Buttons will try to take all available space by default unless they have an icon and no text — icon-only. Wrap a smaller container or use the style attribute combined with the width property to set custom width. Use width: fit-content to make the button adjust to the label.

The label will also be automatically truncated should the text exceed its container’s width.

Badge

The Tertiary Button includes a dedicated badge slot. To display a badge within the button, place a Badge component in this slot using slot="badge".

Setting icons

You can use the icon-template attribute to set an icon for the Tertiary Button.

This can also be combined with the icon-position attribute to set its position

The icon size is managed by the component itself. When there is an icon and no label, the icon size will increase.

Event handling

The TertiaryButton emits a TpgClickEvent when clicked. Below are some examples of how you can handle the event.

Tables

Properties

Attribute Property Description Type Default Value
size size Size of the button, overrides base-class size 'small' | 'regular' 'regular'
label label Textual label of the button string ''
aria-label ariaLabel The aria-label of the button. This is used for accessibility purposes. Defaults to label if defined string
disabled disabled Flag that disables the button, just like vanilla boolean false
icon-template iconTemplate URI-encoded SVG template for the button's icon. Supported constants are found in IconConstant | '' ''
icon-position iconPosition The positioning of the icon 'leading' | 'trailing' | 'top' 'leading'
icon-only-size iconOnlySize The size of the icon when the button has no label IconSize 'large'

Events

Event name Reactjs attribute Description
tpg-click ontpg-click Event emitted when the button is triggered, either by clicking it or pressing space/enter while focused.

Functions

Name Description Arguments
focus This method can be called to shift focus to the button. No parameters

Slots

Name Description
badge Slot dedicated to slotting a badge. NOTE: should NOT be used in conjunction with label and icon!

CSS Parts

Attribute Description
No CSS parts found.

Sandbox