@atlaskit/heading
적절한 위계를 갖춘 접근 가능하고 일관되게 스타일링된 제목을 만들기 위한 컴포넌트예요.
출처: 문서
본문
Heading 컴포넌트
적절한 위계를 갖춘 접근 가능하고 일관되게 스타일링된 제목을 만들기 위한 컴포넌트예요. 제목은 콘텐츠와 대비되도록 크기가 조정되고, 시각적 위계를 높이며, 독자가 콘텐츠의 구조를 쉽게 이해하도록 도와줘요.
- Keywords: heading, title, header, typography, text, h1, h2, h3, h4, h5, h6
- Categories: primitive
- Status: general-availability
예시
import Heading from '@atlaskit/heading/heading';
const _default_1: React.JSX.Element[] = [
<Heading size="xxlarge">Page Title</Heading>,
<Heading size="large" color="color.text.inverse">
Inverted section title
</Heading>,
];
export default _default_1;
Props
| Prop | Type | Description |
|---|---|---|
as |
"div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" |
Allows the component to be rendered as the specified HTML element, overriding a default element set by the size prop |
children |
string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
The text of the heading (required) |
color |
"color.text" | "color.text.inverse" | "color.text.warning.inverse" |
Token representing text color with a built-in fallback value |
id |
string |
Unique identifier for the heading HTML element |
size |
"small" | "xxsmall" | "xsmall" | "medium" | "large" | "xlarge" | "xxlarge" |
Determines which text styles are applied (required) |
사용 지침
- 복잡한 레이아웃에서 제목 레벨을 유지하려면
HeadingContextProvider제공 기능을 사용해요. - 적절한 제목 위계를 유지해요.
- 제목을 간결하고 의미 있게 유지해요.
- 대부분의 제목에 문장형 대소문자(sentence case)를 사용해요.
- 어두운 배경의 역상 텍스트에는
colorprop을 사용해요. - 인라인 스타일을 사용하지 마요. 사용 가능한
size(필수)와color(선택) prop을 반드시 사용해요.
콘텐츠 지침
- 명확하고 설명적인 제목 텍스트를 사용해요.
- 적절한 제목 위계를 유지해요.
- 제목을 간결하고 의미 있게 유지해요.
- 대부분의 제목에 문장형 대소문자(sentence case)를 사용해요.
- 제목이 뒤따르는 콘텐츠를 설명적으로 만들도록 해요.
접근성 지침
- 적절한 제목 위계(h1~h6)를 유지해요.
- 페이지의 주요 제목에는 페이지당 h1을 하나만 사용해요.
- 텍스트 가독성을 위해 최소 4.5:1 색상 대비를 보장해요.
- 아래 콘텐츠를 설명하는 명확하고 설명적인 제목 텍스트를 사용해요.
HeadingContextProvider 컴포넌트
서브트리 안의 모든 제목에 대한 기본 HTML 제목 레벨을 구성할 수 있게 해 주는 컨텍스트 프로바이더예요. 복잡한 레이아웃에서 적절한 제목 위계를 유지하는 데 유용해요.
- Keywords: heading, context, provider, hierarchy, accessibility
- Categories: primitive
- Status: general-availability
예시
import Heading from '@atlaskit/heading/heading';
import HeadingContextProvider from '@atlaskit/heading/heading-context/default';
const _default_1: React.JSX.Element[] = [
<HeadingContextProvider>
<Heading size="xxlarge">h1</Heading>
<Heading size="medium">h2</Heading>
<Heading size="large">h3</Heading>
</HeadingContextProvider>,
];
export default _default_1;
사용 지침
- 다른 제목 위계가 필요한 섹션을 감싸요.
- 제목 레벨을 조정해야 하는 복잡한 레이아웃에 사용해요.
콘텐츠 지침
- 적절한 제목 위계가 유지되도록 해요.
- 명확하고 설명적인 제목 텍스트를 사용해요.
- 제목을 간결하고 의미 있게 유지해요.