본문 바로가기

기타

[Material UI] 리스트 아이템 텍스트 폰트 크기 바꾸기 (ListItemText primary font size)

[Material UI] 리스트 아이템 텍스트 글자 크기 변경하기 (ListItemText primary font size)

 

리스트 아이템 primary 텍스트의 fontSize를 바꾸기 위해 className으로 속성 지정했는데, 글자 크기 안바뀌더라.

찾아보니 className이 아니라 classes를 바꿔야 했음.

ListItemText 폰트 크기 바꾸기

listItemText의 스타일을 지정한 다음,

 

...

 

const useStyles = makeStyles(theme => ({
  listItemText:{
    fontSize:'0.85rem',
  }
}));

<ListItemText> 컴포넌트에 다음과 같이 classes로 추가해주면 된다.

<ListItemText 
	classes={{primary:classes.listItemText}}
	primary={title}
/>

해결!

 

출처 : 스택오버플로우

 

material ui: how to change fontSize in Lists?

I am creating some forms using react js and material UI. I would like to make the font size on some of the lists smaller in order to get a more compact presentation, but no matter at which level I ...

stackoverflow.com

 

~~

 

...

 

~~