Skip to content

Keyboard Button Toggle

<tpg-keyboard-button-toggle></tpg-keyboard-button-toggle>

Keyboard Buttons are used in the on-screen keyboard component and are divided in four categories:

  • Primary Keyboard Button: high emphasis, push buttons used for the actual keys of the keyboard component (letters and numbers)
  • Primary Keyboard Button Toggle: high emphasis, toggle buttons used for the special function keys of the keyboard component
  • Secondary Keyboard Button: low emphasis, push buttons used for the function keys of the keyboard component
  • Secondary Keyboard Button Toggle: low emphasis, toggle buttons used for the function keys of the keyboard component

Examples

Button type

Use the type attribute to set the button’s type.

Label and icon

Use the label attribute to set the label of the button. Use the icon-template attribute (iconTemplate property) to set the icon.

The label won’t be rendered if an icon is set, but is still useful as it is what’s emitted when the keyboard button is pressed

Fill

The keyboard button will by default hug its content. By setting the fill attribute the button will take as much space horizontally as given by its parent container.

Disabled

The keyboard button can be disabled by setting the disabled attribute

Events

The keyboard button emits a TpgInputEvent<boolean> when clicked. The value contains the opposite of the toggle button’s current toggle state.

Tables

Properties

Attribute Property Description Type Default Value
type type The type of button to render. 'primary' | 'secondary' 'primary'
label label Textual label of the button string ''
icon-template iconTemplate URI-encoded SVG template for the button's icon. Supported constants are found in IconConstant | '' ''
disabled disabled Flag that disables the button, just like vanilla boolean false
fill fill Flag that causes the keyboard button to fill its parent container horizontally boolean false
selected selected Defines if the button should be rendered as toggled or not. The consumer is responsible for setting this according to emitted events. boolean false

Events

Event name Reactjs attribute Description
tpg-input ontpg-input Event emitted when the button is triggered by click or press. The value of the event is the inverse of the current toggled state

Functions

Name Description Arguments
No functions found.

Slots

Name Description
No slots found.

CSS Parts

Attribute Description
No CSS parts found.

Sandbox