whats the correct way of inserting label in an Ionic FAB list

后端 未结 6 728
谎友^
谎友^ 2020-12-08 10:56

i want to insert a label so that matches every FAB icon on the Fab list whats the correct way of doing it. the way i did it it doesn\'t work

6条回答
  •  天命终不由人
    2020-12-08 11:21

    I Ionic 4/5 the accepted answer (labels next to icons) doesn't work anymore. You have to use ::after pseudo css styling using a global attribute like item or data-. See the example below:

    HTML:

    
        
          
        
        
          
            
          
          
            
          
        
      
    

    SCSS:

    ion-fab-button[data-desc] {
      position: relative;
    }
    
    ion-fab-button[data-desc]::after {
      position: absolute;
      content: attr(data-desc);
      z-index: 1;
      right: 55px;
      bottom: 4px;
      background-color: var(--ion-color-primary);
      padding: 9px;
      border-radius: 15px;
      color: white;
      box-shadow: 0 3px 5px -1px rgba(0,0,0,0.2), 0 6px 10px 0 rgba(0,0,0,0.14), 0 1px 18px 0 rgba(0,0,0,0.12);
    }
    

    Source: https://forum.ionicframework.com/t/fab-labels-in-ionic-4/139823/6

提交回复
热议问题