타이포그래피 유틸리티
타이포그래피 유틸리티 (Typography utilities)
텍스트 정렬, 줄바꿈, 잘림, 숫자, 색상, 크기를 다루는 EUI 타이포그래피 유틸리티들을 살펴보는 페이지예요.
출처: 문서
본문
Alignment (정렬)
.eui-textLeft className
요소의 텍스트 정렬을 컨테이너의 왼쪽/시작 쪽으로 바꿔요.
Left align text
<div className="eui-textLeft">
/* Your content */
</div>
.eui-textCenter className
요소의 텍스트 정렬을 컨테이너의 중앙으로 바꿔요.
Center align text
<div className="eui-textCenter">
/* Your content */
</div>
.eui-textRight className
요소의 텍스트 정렬을 컨테이너의 오른쪽/끝 쪽으로 바꿔요.
Right align text
<div className="eui-textRight">
/* Your content */
</div>
Wrapping (줄바꿈)
euiTextTruncate(maxWidth?) function
텍스트를 부모의 100% 너비에서 잘라내고 생략 부호(ellipsis)를 표시해요. 이 유틸리티는 잘린 텍스트의 최대 너비를 커스터마이즈하기 위한 단일 선택 파라미터를 받아요. 전달하지 않으면 max-width: 100%;가 기본값이 돼요.
팁: 텍스트를 잘라낼 때는 HTML
title속성에 전체 텍스트를 포함하거나 요소를 EuiToolTip으로 감싸는 것을 권장해요.
This text will not to wrap but truncate beyond the boundaries of the yellow box.
${euiTextTruncate()}
.eui-textTruncate className
euiTextTruncate() 스타일을 덮어쓰는 CSS 유틸리티 클래스로 적용해요.
This text will not to wrap but truncate beyond the boundaries of the yellow box.
<div
className="eui-textTruncate"
title="Your content">
/* Your content */
</div>
euiTextBreakWord() function
평소처럼 여러 줄에 걸쳐 텍스트를 감싸지만, URL 같은 긴 단어는 강제로 끊어요.
This text will wrap like normal but this long link http://www.hithereimalongurl.com/dave_will_just_ramble_on_in_a_long_sentence_like_this/?ok=cool will break mid-word.
${euiTextBreakWord()}
.eui-textBreakWord className
euiTextBreakWord() 스타일을 덮어쓰는 CSS 유틸리티 클래스로 적용해요.
This text will wrap like normal but this long link http://www.hithereimalongurl.com/dave_will_just_ramble_on_in_a_long_sentence_like_this/?ok=cool will break mid-word.
<div className="eui-textBreakWord">
/* Your content */
</div>
.eui-textNoWrap className
작은 컨테이너에서도 텍스트가 줄바꿈되지 않도록 강제해요.
This text will not wrap and will overflow the boundaries of the yellow box.
<div className="eui-textNoWrap">
/* Your content */
</div>
.eui-textBreakAll className
항상 줄의 마지막 단어를 끊도록 텍스트를 여러 줄에 걸쳐 감싸요.
This text block will wrap, breaking up anything including long URLs http://www.hithereimalongurl.com/dave_will_just_ramble_on_in_a_long_sentence_like_this/?ok=cool and run on strings like this --------------------------------------------------------------------------.
<div className="eui-textBreakAll">
/* Your content */
</div>
.eui-textBreakNormal className
단어 끊기를 강제하지 않는 일반적인 줄바꿈 방식으로 텍스트를 되돌려요.
This text block will wrap normally, but will not break long URLs http://www.hithereimalongurl.com/dave_will_just_ramble_on_in_a_long_sentence_like_this/?ok=cool but may break run on strings like this ---------------------------------------------------------------.
<div className="eui-textBreakNormal">
/* Your content */
</div>
Numbers (숫자)
euiNumberFormat(euiTheme) function
font-feature-settings: "tnum";을 적용해서 특히 오른쪽 정렬 시 숫자가 컬럼에서 더 잘 정렬되도록 해요.
Without function
11317.11
0040.900
With function
11317.11
0040.900
${euiNumberFormat(useEuiTheme())}
.eui-textNumber className
euiNumberFormat() 스타일을 덮어쓰는 CSS 유틸리티 클래스로 적용해요.
Without class
11317.11
0040.900
With class
11317.11
0040.900
<div className="eui-textNumber">
/* Your number content */
</div>
Color (색상)
.eui-textInheritColor className
컴포넌트가 부모로부터 텍스트 색상을 상속하도록 강제해요. 텍스트 색상을 명명된 색상 중 하나로 바꾸려면 EuiText 또는 EuiTextColor를 사용하세요.
I am code that matches the EuiTextColor
<EuiTextColor color="danger">
<EuiCode className="eui-textInheritColor">I am danger code</EuiCode>
</EuiTextColor>
Size (크기)
euiFontSizeFromScale(scale, euiTheme, options?) function
일관된 타이포그래피를 위해 테마의 스케일 시스템을 사용해 font-size 값을 계산해요. 스케일 키('xxxs', 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl'), euiTheme 객체, 그리고 단위나 커스텀 스케일링을 위한 선택 파라미터를 받아요.
s scale
This text uses euiFontSizeFromScale('s')
m scale
This text uses euiFontSizeFromScale('m')
l scale
This text uses euiFontSizeFromScale('l')
font-size: ${euiFontSizeFromScale('m', euiTheme)};
euiLineHeightFromBaseline(scale, euiTheme, options?) function
일관된 세로 리듬을 위해 baseline 그리드에 정렬된 line-height 값을 계산해요. euiFontSizeFromScale과 같은 스케일 시스템을 사용하고 baseline 정렬을 유지하도록 자동으로 조정해요.
Regular line-height: 1.5
This text uses a regular line-height of 1.5. Notice how it doesn't align to the baseline grid.
Baseline-aligned line-height
This text uses euiLineHeightFromBaseline('m') to align to the baseline grid for consistency.
line-height: ${euiLineHeightFromBaseline('m', euiTheme)};
euiTextShift(fontWeight?, attribute?, euiTheme) function
hover나 focus 시 font-weight를 바꿀 때 레이아웃 이동(shift)을 방지해요. 굵은 가중치를 위한 공간을 예약하는 보이지 않는 의사 요소를 만들어요. 상태 변경 시 가중치가 변하는 인터랙티브 텍스트에 유용해요. data-text 속성을 전달하는 것을 잊지 마세요!
This is important for euiTextShift to work correctly.
Without euiTextShift
Hover me
- Notice layout shift on hover
With euiTextShift
Hover me
- No layout shift on hover
${euiTextShift('bold', 'data-text', euiTheme)}
&:hover {
font-weight: ${euiTheme.font.weight.bold};
}