Skip to content

ToastConfig

Defined in: ui/Toast.ts:48

Configuration interface for creating a Toast notification.

Example

// Basic toast with default settings
const config: ToastConfig = {
message: "Operation successful!",
type: "success"
};
// Custom styled toast with shadow and close button
const config: ToastConfig = {
message: "Custom notification",
backgroundColor: 0x9b59b6,
backgroundAlpha: 1,
cornerRadius: 8,
shadow: {
color: 0x000000,
alpha: 0.2,
offset: { x: 4, y: 4 }
},
closeButton: {
show: true,
position: 'top right'
}
};

Properties

autoClose?

optional autoClose: boolean

Defined in: ui/Toast.ts:72

Whether the toast should automatically close after duration


backgroundAlpha?

optional backgroundAlpha: number

Defined in: ui/Toast.ts:66

Background opacity (0-1)


backgroundColor?

optional backgroundColor: number

Defined in: ui/Toast.ts:64

Background color in hex format


class?

optional class: typeof Toast

Defined in: ui/Toast.ts:50

Optional custom Toast class to use instead of the default


closeButton?

optional closeButton: object

Defined in: ui/Toast.ts:91

Close button configuration

class?

optional class: typeof Button

Custom button class to use

offset?

optional offset: number

Offset from the edges

position?

optional position: CloseButtonPosition

Position of the close button

show?

optional show: boolean

Whether to show the close button

size?

optional size: number

Size of the close button


colorBarWidth?

optional colorBarWidth: number

Defined in: ui/Toast.ts:80

Width of the colored type indicator bar


cornerRadius?

optional cornerRadius: number

Defined in: ui/Toast.ts:68

Corner radius for rounded corners


duration?

optional duration: number

Defined in: ui/Toast.ts:56

Duration in milliseconds before auto-closing (if autoClose is true)


height?

optional height: number

Defined in: ui/Toast.ts:62

Height of the toast in pixels


message

message: string

Defined in: ui/Toast.ts:52

The message to display in the toast


padding?

optional padding: number

Defined in: ui/Toast.ts:70

Padding around the content


shadow?

optional shadow: object

Defined in: ui/Toast.ts:82

Shadow configuration for depth effect

alpha?

optional alpha: number

Shadow opacity (0-1)

color?

optional color: number

Shadow color in hex format

offset?

optional offset: object

Shadow offset from the toast

offset.x

x: number

offset.y

y: number


style?

optional style: Partial<TextStyle>

Defined in: ui/Toast.ts:58

Custom text style options


textAlign?

optional textAlign: "right" | "left" | "center"

Defined in: ui/Toast.ts:76

Horizontal text alignment


textColors?

optional textColors: Record<ToastType, number>

Defined in: ui/Toast.ts:74

Custom colors for each toast type’s indicator


type?

optional type: ToastType

Defined in: ui/Toast.ts:54

Type of toast, determines the color indicator


verticalAlign?

optional verticalAlign: "top" | "bottom" | "middle"

Defined in: ui/Toast.ts:78

Vertical text alignment


width?

optional width: number

Defined in: ui/Toast.ts:60

Width of the toast in pixels