YouTube.js
Guide
Discord
GitHub
Guide
Discord
GitHub

youtubei.js / YTNodes / ButtonView

Class: ButtonView

Extends

  • YTNode

Constructors

new ButtonView()

new ButtonView(data): ButtonView

Parameters

• data: RawNode

Returns

ButtonView

Overrides

YTNode.constructor

Defined in

src/parser/classes/ButtonView.ts:38

Properties

accessibility_id?

optional accessibility_id: string

Defined in

src/parser/classes/ButtonView.ts:30


accessibility_text?

optional accessibility_text: string

Defined in

src/parser/classes/ButtonView.ts:36


button_size?

optional button_size: "BUTTON_VIEW_MODEL_SIZE_UNKNOWN" | "BUTTON_VIEW_MODEL_SIZE_DEFAULT" | "BUTTON_VIEW_MODEL_SIZE_COMPACT" | "BUTTON_VIEW_MODEL_SIZE_XSMALL" | "BUTTON_VIEW_MODEL_SIZE_LARGE" | "BUTTON_VIEW_MODEL_SIZE_XLARGE" | "BUTTON_VIEW_MODEL_SIZE_XXLARGE"

Defined in

src/parser/classes/ButtonView.ts:14


button_type?

optional button_type: "BUTTON_VIEW_MODEL_TYPE_UNKNOWN" | "BUTTON_VIEW_MODEL_TYPE_FILLED" | "BUTTON_VIEW_MODEL_TYPE_OUTLINE" | "BUTTON_VIEW_MODEL_TYPE_TEXT" | "BUTTON_VIEW_MODEL_TYPE_TONAL"

Defined in

src/parser/classes/ButtonView.ts:28


custom_background_color?

optional custom_background_color: number

Defined in

src/parser/classes/ButtonView.ts:31


custom_border_color?

optional custom_border_color: number

Defined in

src/parser/classes/ButtonView.ts:19


custom_dark_theme_border_color?

optional custom_dark_theme_border_color: number

Defined in

src/parser/classes/ButtonView.ts:23


custom_font_color?

optional custom_font_color: number

Defined in

src/parser/classes/ButtonView.ts:27


enable_full_width_margins?

optional enable_full_width_margins: boolean

Defined in

src/parser/classes/ButtonView.ts:26


enable_icon_button?

optional enable_icon_button: boolean

Defined in

src/parser/classes/ButtonView.ts:11


enabled?

optional enabled: boolean

Defined in

src/parser/classes/ButtonView.ts:29


icon_image?

optional icon_image: object

Defined in

src/parser/classes/ButtonView.ts:22


icon_image_flip_for_rtl?

optional icon_image_flip_for_rtl: boolean

Defined in

src/parser/classes/ButtonView.ts:13


icon_name?

optional icon_name: string

Defined in

src/parser/classes/ButtonView.ts:10


icon_position?

optional icon_position: "BUTTON_VIEW_MODEL_ICON_POSITION_UNKNOWN" | "BUTTON_VIEW_MODEL_ICON_POSITION_TRAILING" | "BUTTON_VIEW_MODEL_ICON_POSITION_LEADING" | "BUTTON_VIEW_MODEL_ICON_POSITION_ABOVE" | "BUTTON_VIEW_MODEL_ICON_POSITION_LEADING_TRAILING"

Defined in

src/parser/classes/ButtonView.ts:15


icon_trailing?

optional icon_trailing: boolean

Defined in

src/parser/classes/ButtonView.ts:35


is_full_width?

optional is_full_width: boolean

Defined in

src/parser/classes/ButtonView.ts:16


on_disabled_tap?

optional on_disabled_tap: NavigationEndpoint

Defined in

src/parser/classes/ButtonView.ts:18


on_long_press?

optional on_long_press: NavigationEndpoint

Defined in

src/parser/classes/ButtonView.ts:32


on_tap?

optional on_tap: NavigationEndpoint

Defined in

src/parser/classes/ButtonView.ts:20


on_visible?

optional on_visible: object

Defined in

src/parser/classes/ButtonView.ts:34


secondary_icon_image?

optional secondary_icon_image: Thumbnail[]

Defined in

src/parser/classes/ButtonView.ts:9


state?

optional state: "BUTTON_VIEW_MODEL_STATE_UNKNOWN" | "BUTTON_VIEW_MODEL_STATE_ACTIVE" | "BUTTON_VIEW_MODEL_STATE_INACTIVE" | "BUTTON_VIEW_MODEL_STATE_DISABLED"

Defined in

src/parser/classes/ButtonView.ts:17


style?

optional style: "BUTTON_VIEW_MODEL_STYLE_UNKNOWN" | "BUTTON_VIEW_MODEL_STYLE_CTA" | "BUTTON_VIEW_MODEL_STYLE_BRAND" | "BUTTON_VIEW_MODEL_STYLE_ADS_CTA" | "BUTTON_VIEW_MODEL_STYLE_OVERLAY" | "BUTTON_VIEW_MODEL_STYLE_CTA_THEMED" | "BUTTON_VIEW_MODEL_STYLE_BLACK_CTA" | "BUTTON_VIEW_MODEL_STYLE_CUSTOM" | "BUTTON_VIEW_MODEL_STYLE_MONO" | "BUTTON_VIEW_MODEL_STYLE_OVERLAY_DARK" | "BUTTON_VIEW_MODEL_STYLE_CTA_OVERLAY" | "BUTTON_VIEW_MODEL_STYLE_BRAND_AI" | "BUTTON_VIEW_MODEL_STYLE_YT_GRADIENT" | "BUTTON_VIEW_MODEL_STYLE_BRAND_GRADIENT"

Defined in

src/parser/classes/ButtonView.ts:21


target_id?

optional target_id: string

Defined in

src/parser/classes/ButtonView.ts:25


title?

optional title: string

Defined in

src/parser/classes/ButtonView.ts:24


title_formatted?

optional title_formatted: object

Defined in

src/parser/classes/ButtonView.ts:33


tooltip?

optional tooltip: string

Defined in

src/parser/classes/ButtonView.ts:12


type

readonly type: string

Inherited from

YTNode.type

Defined in

src/parser/helpers.ts:8


type

static type: string = 'ButtonView'

Overrides

YTNode.type

Defined in

src/parser/classes/ButtonView.ts:7

Methods

as()

as<T, K>(...types): InstanceType<K[number]>

Cast to one of the given types.

Type Parameters

• T extends YTNode

• K extends YTNodeConstructor<T>[]

Parameters

• ...types: K

The types to cast to

Returns

InstanceType<K[number]>

The node cast to one of the given types

Throws

If the node is not of the given type

Inherited from

YTNode.as

Defined in

src/parser/helpers.ts:29


hasKey()

hasKey<T, R>(key): this is ButtonView & { [k in string]: R }

Check for a key without asserting the type.

Type Parameters

• T extends string

• R = any

Parameters

• key: T

The key to check

Returns

this is ButtonView & { [k in string]: R }

Whether the node has the key

Inherited from

YTNode.hasKey

Defined in

src/parser/helpers.ts:41


is()

is<T, K>(...types): this is InstanceType<K[number]>

Check if the node is of the given type.

Type Parameters

• T extends YTNode

• K extends YTNodeConstructor<T>[]

Parameters

• ...types: K

The type to check

Returns

this is InstanceType<K[number]>

whether the node is of the given type

Inherited from

YTNode.is

Defined in

src/parser/helpers.ts:19


key()

key<T, R>(key): Maybe

Assert that the node has the given key and return it.

Type Parameters

• T extends string

• R = any

Parameters

• key: T

The key to check

Returns

Maybe

The value of the key wrapped in a Maybe

Throws

If the node does not have the key

Inherited from

YTNode.key

Defined in

src/parser/helpers.ts:51

Edit this page
Last Updated:: 6/8/25, 5:43 PM
Contributors: Luan