Skip to content

ToastConfig

Defined in: ui/Toast.ts:48

Configuration interface for creating a Toast notification.

// 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'
}
};

optional autoClose: boolean

Defined in: ui/Toast.ts:72

Whether the toast should automatically close after duration


optional backgroundAlpha: number

Defined in: ui/Toast.ts:66

Background opacity (0-1)


optional backgroundColor: number

Defined in: ui/Toast.ts:64

Background color in hex format


optional class: typeof Toast

Defined in: ui/Toast.ts:50

Optional custom Toast class to use instead of the default


optional closeButton: object

Defined in: ui/Toast.ts:91

Close button configuration

optional class: typeof Button

Custom button class to use

optional offset: number

Offset from the edges

optional position: CloseButtonPosition

Position of the close button

optional show: boolean

Whether to show the close button

optional size: number

Size of the close button


optional colorBarWidth: number

Defined in: ui/Toast.ts:80

Width of the colored type indicator bar


optional cornerRadius: number

Defined in: ui/Toast.ts:68

Corner radius for rounded corners


optional duration: number

Defined in: ui/Toast.ts:56

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


optional height: number

Defined in: ui/Toast.ts:62

Height of the toast in pixels


message: string

Defined in: ui/Toast.ts:52

The message to display in the toast


optional padding: number

Defined in: ui/Toast.ts:70

Padding around the content


optional shadow: object

Defined in: ui/Toast.ts:82

Shadow configuration for depth effect

optional alpha: number

Shadow opacity (0-1)

optional color: number

Shadow color in hex format

optional offset: object

Shadow offset from the toast

x: number

y: number


optional style: Partial<TextStyle>

Defined in: ui/Toast.ts:58

Custom text style options


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

Defined in: ui/Toast.ts:76

Horizontal text alignment


optional textColors: Record<ToastType, number>

Defined in: ui/Toast.ts:74

Custom colors for each toast type’s indicator


optional type: ToastType

Defined in: ui/Toast.ts:54

Type of toast, determines the color indicator


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

Defined in: ui/Toast.ts:78

Vertical text alignment


optional width: number

Defined in: ui/Toast.ts:60

Width of the toast in pixels