mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
@ -242,6 +242,14 @@ that is called in the same circustances.
|
|||||||
Present the toast overlay after it has been created.
|
Present the toast overlay after it has been created.
|
||||||
|
|
||||||
|
|
||||||
|
## CSS Custom Properties
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
| ---------------- | ------------------------ |
|
||||||
|
| `--background` | Background of the toast |
|
||||||
|
| `--button-color` | Color of the button text |
|
||||||
|
| `--color` | Color of the toast text |
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
<button onclick="presentToastWithOptions({message: 'click to close', showCloseButton: true})">Show Toast with Close Button</button>
|
<button onclick="presentToastWithOptions({message: 'click to close', showCloseButton: true})">Show Toast with Close Button</button>
|
||||||
<button onclick="presentToastWithOptions({message: 'click to close', showCloseButton: true, closeButtonText: 'closing time'})">Show Toast with Custom Close Button Text</button>
|
<button onclick="presentToastWithOptions({message: 'click to close', showCloseButton: true, closeButtonText: 'closing time'})">Show Toast with Custom Close Button Text</button>
|
||||||
<button onclick="presentToastWithOptions({message: 'click to close', showCloseButton: true, translucent: true})">Show Translucent Toast</button>
|
<button onclick="presentToastWithOptions({message: 'click to close', showCloseButton: true, translucent: true})">Show Translucent Toast</button>
|
||||||
|
<button onclick="presentToastWithOptions({message: 'click to close', showCloseButton: true, cssClass: 'custom'})">Show Toast with Custom Properties</button>
|
||||||
|
|
||||||
<ion-toast-controller></ion-toast-controller>
|
<ion-toast-controller></ion-toast-controller>
|
||||||
|
|
||||||
@ -32,6 +33,12 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.custom {
|
||||||
|
--background: papayawhip;
|
||||||
|
--button-color: blue;
|
||||||
|
--color: red;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@ -5,6 +5,10 @@
|
|||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
.toast-ios {
|
.toast-ios {
|
||||||
|
--background: #{$toast-ios-background-color};
|
||||||
|
--button-color: #{$toast-ios-button-color};
|
||||||
|
--color: #{$toast-ios-title-color};
|
||||||
|
|
||||||
font-family: $toast-ios-font-family;
|
font-family: $toast-ios-font-family;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,8 +22,6 @@
|
|||||||
|
|
||||||
max-width: $toast-max-width;
|
max-width: $toast-max-width;
|
||||||
|
|
||||||
background: $toast-ios-background-color;
|
|
||||||
|
|
||||||
z-index: $z-index-overlay-wrapper;
|
z-index: $z-index-overlay-wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,11 +49,11 @@
|
|||||||
.toast-ios .toast-message {
|
.toast-ios .toast-message {
|
||||||
@include padding($toast-ios-title-padding-top, $toast-ios-title-padding-end, $toast-ios-title-padding-bottom, $toast-ios-title-padding-start);
|
@include padding($toast-ios-title-padding-top, $toast-ios-title-padding-end, $toast-ios-title-padding-bottom, $toast-ios-title-padding-start);
|
||||||
|
|
||||||
color: $toast-ios-title-color;
|
color: var(--color);
|
||||||
|
|
||||||
font-size: $toast-ios-title-font-size;
|
font-size: $toast-ios-title-font-size;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toast-ios .toast-button {
|
.toast-ios .toast-button {
|
||||||
color: $toast-ios-button-color;
|
color: var(--button-color);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,9 @@
|
|||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
.toast-md {
|
.toast-md {
|
||||||
|
--background: #{$toast-md-background};
|
||||||
|
--color: #{toast-md-title-color};
|
||||||
|
|
||||||
font-family: $toast-md-font-family;
|
font-family: $toast-md-font-family;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,8 +21,6 @@
|
|||||||
width: $toast-width;
|
width: $toast-width;
|
||||||
max-width: $toast-max-width;
|
max-width: $toast-max-width;
|
||||||
|
|
||||||
background: $toast-md-background;
|
|
||||||
|
|
||||||
z-index: $z-index-overlay-wrapper;
|
z-index: $z-index-overlay-wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +43,7 @@
|
|||||||
.toast-md .toast-message {
|
.toast-md .toast-message {
|
||||||
@include padding($toast-md-title-padding-top, $toast-md-title-padding-end, $toast-md-title-padding-bottom, $toast-md-title-padding-start);
|
@include padding($toast-md-title-padding-top, $toast-md-title-padding-end, $toast-md-title-padding-bottom, $toast-md-title-padding-start);
|
||||||
|
|
||||||
color: $toast-md-title-color;
|
color: var(--color);
|
||||||
|
|
||||||
font-size: $toast-md-title-font-size;
|
font-size: $toast-md-title-font-size;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,12 @@
|
|||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|
||||||
ion-toast {
|
ion-toast {
|
||||||
|
/**
|
||||||
|
* @prop --background: Background of the toast
|
||||||
|
* @prop --button-color: Color of the button text
|
||||||
|
* @prop --color: Color of the toast text
|
||||||
|
*/
|
||||||
|
|
||||||
@include position(0, null, null, 0);
|
@include position(0, null, null, 0);
|
||||||
|
|
||||||
display: block;
|
display: block;
|
||||||
@ -17,6 +23,10 @@ ion-toast {
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toast-wrapper {
|
||||||
|
background: var(--background);
|
||||||
|
}
|
||||||
|
|
||||||
.toast-container {
|
.toast-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user