Skip to content

Toast customization - toast wrapper border color and toast CSS property #16666

Closed

Description

@ashinpaugh

Feature Request

Ionic version:

[x] 4.x

Describe the Feature Request
Beta 16 added the --color property to the toast component, and toast-wrapper was put into shadow dom meaning we can no longer style the toast content.

I added CSS definitions that worked in beta 13 that added borders to toast-wrapper, which indicated success / error / info / warning / etc. After upgrading it's no longer possible to use these definitions.

Describe Preferred Solution
I would either like to see a --border property exposed to the toast-wrapper, or to have the toast's CSS property added to the .toast-wrapper like this post recommends @see #16253

Related Code
Ionic related code:

this.toast = await this.toastCtrl.create({
      duration: 500000,
      position: 'top',
      message:  text,
      // color:    color,
      cssClass: color, // Currently useless as far as I can tell.
    });

Example of the CSS definitions I'd like to continue to be able to use:

ion-toast {
  text-align: center;

  &.info {
    .toast-wrapper {
      border: 2px solid var(--app-component-border);
    }
  }

...
}

Additional Context

app $ ionic info

Ionic:

   ionic (Ionic CLI)             : 4.5.0 (/Users/developer/.npm-packages/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.17
   @angular-devkit/build-angular : 0.10.7
   @angular-devkit/schematics    : 7.0.7
   @angular/cli                  : 7.0.7
   @ionic/angular-toolkit        : 1.2.0

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.4, (and 12 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/developer/Library/Android/sdk)
   ios-deploy        : 2.0.0
   NodeJS            : v8.12.0 (/usr/local/Cellar/node@8/8.12.0/bin/node)
   npm               : 6.4.1
   OS                : macOS High Sierra
   Xcode             : Xcode 9.4.1 Build version 9F2000

Activity

  1. added
    type: feature request
    package: core
    on Dec 11, 2018
  2. changed the title [-]Toast customization - toast wrapper border color / and toast CSS property[/-] [+]Toast customization - toast wrapper border color and toast CSS property[/+] on Dec 11, 2018
  3. self-assigned this
    on Dec 11, 2018
  4. paulstelzer commented on Dec 11, 2018

    @paulstelzer
    Contributor

    Closed by #16679

  5. paulstelzer commented on Dec 11, 2018

    @paulstelzer
    Contributor

    @ashinpaugh With the next beta, you can add your cssClass and then use this variables:

       * @prop --border-color: Border color of the toast
       * @prop --border-radius: Border radius of the toast
       * @prop --border-width: Border width of the toast
       * @prop --border-style: Border style of the toast
    

    For example (if you add cssClass: 'info'):

    ion-toast.info {
          --border-radius: 20px;
          --border-width: 5px;
          --border-style: double;
          --border-color: var(--ion-color-info);
    }
    
  6. ashinpaugh commented on Dec 11, 2018

    @ashinpaugh
    Author

    Cheers man - much appreciated.

  7. ionitron-bot commented on Jan 10, 2019

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  8. locked and limited conversation to collaborators on Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

package: coretype: feature request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions