How to align horizontal icon and text in Material-UI

前端 未结 8 1985
后悔当初
后悔当初 2021-01-31 07:35

I am a newbie in material-ui, now my icon and text are not aligned :

\"not

My desired results:

8条回答
  •  北恋
    北恋 (楼主)
    2021-01-31 08:07

    Same problem here, this is what I did.

    import LinkIcon from '@material-ui/icons/Link';
    import styled from 'styled-components';
    ...
    const Resolve = styled.div`
      display: flex;
      vertical-align: middle,
    `;
    
    
      
      

    resolve

    If you aren't happy with mUI default link icon you can always DIY:

    {/* this is the same chained icon used in the own material-ui, 
    idk why this ins't avaiable yet */}
    
    function CustomLinkIcon(props) {
      return (
        
          
        
      );
    }
    ...
    
      
      

    resolve

提交回复
热议问题