기본 텍스트 primitive입니다.
<Text>The quick brown fox jumps over the lazy dog.</Text>
이 컴포넌트는 span 요소를 기반으로 하며 common margin props를 지원합니다.
| Prop | Type | Default |
|---|---|---|
as | "span" | "div" | "label" | "p" | "span" |
asChild | boolean | No default value |
size | Responsive<enum> | No default value |
weight | Responsive<"light" | "regular" | "medium" | "bold"> | No default value |
align | Responsive<"left" | "center" | "right"> | No default value |
trim | Responsive<"normal" | "start" | "end" | "both"> | No default value |
truncate | boolean | No default value |
wrap | Responsive<"wrap" | "nowrap" | "pretty" | "balance"> | No default value |
color | enum | No default value |
highContrast | boolean | No default value |
as prop을 사용하여 텍스트를 p, label, div 또는 span으로 렌더링합니다. 이 prop은 순전히 의미론적이며 시각적 외관을 변경하지 않습니다.
This is a paragraph element.
<Text as="p">This is a <Strong>paragraph</Strong> element.</Text>
<Text as="label">This is a <Strong>label</Strong> element.</Text>
<Text as="div">This is a <Strong>div</Strong> element.</Text>
<Text as="span">This is a <Strong>span</Strong> element.</Text>
size prop을 사용하여 텍스트 크기를 제어합니다. 이 prop은 올바른 줄 높이와 수정된 글자 간격을 제공합니다. 텍스트 크기가 증가함에 따라 상대적인 줄 높이와 글자 간격이 감소합니다.
<Flex direction="column" gap="3">
<Text size="1">The quick brown fox jumps over the lazy dog.</Text>
<Text size="2">The quick brown fox jumps over the lazy dog.</Text>
<Text size="3">The quick brown fox jumps over the lazy dog.</Text>
<Text size="4">The quick brown fox jumps over the lazy dog.</Text>
<Text size="5">The quick brown fox jumps over the lazy dog.</Text>
<Text size="6">The quick brown fox jumps over the lazy dog.</Text>
<Text size="7">The quick brown fox jumps over the lazy dog.</Text>
<Text size="8">The quick brown fox jumps over the lazy dog.</Text>
<Text size="9">The quick brown fox jumps over the lazy dog.</Text>
</Flex>
크기 2-4는 장기 콘텐츠에 잘 작동하도록 설계되었습니다.
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant. The question is: What proportion(s) will give us the best results? The golden ratio is often observed in nature where beauty and utility intersect; perhaps we can use this “divine” proportion to enhance these attributes in our typography.
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant. The question is: What proportion(s) will give us the best results? The golden ratio is often observed in nature where beauty and utility intersect; perhaps we can use this “divine” proportion to enhance these attributes in our typography.
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant. The question is: What proportion(s) will give us the best results? The golden ratio is often observed in nature where beauty and utility intersect; perhaps we can use this “divine” proportion to enhance these attributes in our typography.
<Text as="p" mb="5" size="4">
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant. The question is: What proportion(s) will give us the best results? The golden ratio is often observed in nature where beauty and utility intersect; perhaps we can use this “divine” proportion to enhance these attributes in our typography.
</Text>
<Text as="p" mb="5" size="3">
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant. The question is: What proportion(s) will give us the best results? The golden ratio is often observed in nature where beauty and utility intersect; perhaps we can use this “divine” proportion to enhance these attributes in our typography.
</Text>
<Text as="p" size="2" color="gray">
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant. The question is: What proportion(s) will give us the best results? The golden ratio is often observed in nature where beauty and utility intersect; perhaps we can use this “divine” proportion to enhance these attributes in our typography.
</Text>
크기 1-3은 UI 레이블에 잘 작동하도록 설계되었습니다.
<Grid align="center" columns="2" gap="5" p="3">
<Flex direction="column">
<Text size="3" weight="bold">
Get started
</Text>
<Text color="gray" size="2">
Start your next project in minutes
</Text>
</Flex>
<Flex direction="column">
<Text size="2" weight="bold">
Get started
</Text>
<Text color="gray" size="2">
Start your next project in minutes
</Text>
</Flex>
<Flex direction="column">
<Text size="2" weight="bold">
Get started
</Text>
<Text color="gray" size="1">
Start your next project in minutes
</Text>
</Flex>
<Flex direction="column">
<Text size="1" weight="bold">
Get started
</Text>
<Text color="gray" size="1">
Start your next project in minutes
</Text>
</Flex>
</Grid>
weight prop을 사용하여 텍스트의 두께를 설정합니다.
<Text weight="regular" as="div">
The quick brown fox jumps over the lazy dog.
</Text>
<Text weight="medium" as="div">
The quick brown fox jumps over the lazy dog.
</Text>
<Text weight="bold" as="div">
The quick brown fox jumps over the lazy dog.
</Text>
align prop을 사용하여 텍스트 정렬을 설정합니다.
<Text align="left" as="div">Left-aligned</Text>
<Text align="center" as="div">Center-aligned</Text>
<Text align="right" as="div">Right-aligned</Text>
trim prop을 사용하여 텍스트 상자의 시작, 끝 또는 양쪽에서 여백을 잘라냅니다.
이 prop은 다가오는 half-leading control 사양과 유사하게 작동하지만, 모든 브라우저 지원을 위해 일반적인 negative margin workaround를 사용합니다.
<Flex direction="column" gap="3">
<Text
trim="normal"
style={{
background: "var(--gray-a2)",
borderTop: "1px dashed var(--gray-a7)",
borderBottom: "1px dashed var(--gray-a7)",
}}
>
Without trim
</Text>
<Text
trim="both"
style={{
background: "var(--gray-a2)",
borderTop: "1px dashed var(--gray-a7)",
borderBottom: "1px dashed var(--gray-a7)",
}}
>
With trim
</Text>
</Flex>
여는 여백을 잘라내는 것은 카드나 다른 "박스형" 컴포넌트에서 수직 간격을 조정할 때 유용합니다. 그렇지 않으면 Padding이 위와 아래에서 측면보다 더 크게 보입니다.
<Flex direction="column" gap="3">
<Box
style={{
background: "var(--gray-a2)",
border: "1px dashed var(--gray-a7)",
}}
p="4"
>
<Heading mb="1" size="3">
Without trim
</Heading>
<Text>
The goal of typography is to relate font size, line height, and line width
in a proportional way that maximizes beauty and makes reading easier and
more pleasant.
</Text>
</Box>
<Box
p="4"
style={{
background: "var(--gray-a2)",
border: "1px dashed var(--gray-a7)",
}}
>
<Heading mb="1" size="3" trim="start">
With trim
</Heading>
<Text trim="end">
The goal of typography is to relate font size, line height, and line width
in a proportional way that maximizes beauty and makes reading easier and
more pleasant.
</Text>
</Box>
</Flex>
기본 트림 값은 Confy-ui Themes에서 사용되는 시스템 글꼴 스택에 대해 구성됩니다. 사용자 정의 글꼴을 사용하는 경우, 해당 CSS 변수를 사용하여 트림 값을 조정할 수 있습니다.
.radix-themes {
--default-leading-trim-start: 0.42em;
--default-leading-trim-end: 0.36em;
--heading-leading-trim-start: 0.42em;
--heading-leading-trim-end: 0.36em;
}
truncate prop을 사용하여 텍스트가 컨테이너를 초과할 때 생략 부호로 잘립니다.
<Flex maxWidth="300px">
<Text truncate>
The goal of typography is to relate font size, line height, and line width
in a proportional way that maximizes beauty and makes reading easier and
more pleasant.
</Text>
</Flex>
wrap prop을 사용하여 텍스트 래핑을 제어합니다.
<Flex maxWidth="270px">
<Text wrap="nowrap">
The goal of typography is to relate font size, line height, and line width
in a proportional way that maximizes beauty and makes reading easier and
more pleasant.
</Text>
</Flex>
<Flex maxWidth="270px">
<Text wrap="balance">
The goal of typography is to relate font size, line height, and line width
in a proportional way that maximizes beauty and makes reading easier and
more pleasant.
</Text>
</Flex>
<Flex maxWidth="270px">
<Text wrap="pretty">
The goal of typography is to relate font size, line height, and line width
in a proportional way that maximizes beauty and makes reading easier and
more pleasant.
</Text>
</Flex>
text-wrap: pretty는 모든 브라우저에서 지원되지 않는 실험적 값입니다. 그러나 이를 지원하는 브라우저에 대해 점진적 향상으로 처리할 수 있습니다.
color prop을 사용하여 특정 색상을 지정합니다. 텍스트 색상은 일반 배경 색상에 대해 최소 Lc 60 APCA 대비를 달성하도록 설계되었습니다.
<Flex direction="column">
<Text color="indigo">The quick brown fox jumps over the lazy dog.</Text>
<Text color="cyan">The quick brown fox jumps over the lazy dog.</Text>
<Text color="orange">The quick brown fox jumps over the lazy dog.</Text>
<Text color="crimson">The quick brown fox jumps over the lazy dog.</Text>
</Flex>
highContrast prop을 사용하여 배경과의 색상 대비를 높입니다.
<Flex direction="column">
<Text color="gray">The quick brown fox jumps over the lazy dog.</Text>
<Text color="gray" highContrast>
The quick brown fox jumps over the lazy dog.
</Text>
</Flex>
형식 구성 요소와 함께 Text를 조합하여 콘텐츠에 강조와 구조를 추가합니다.
Look, such a helpful link, an italic emphasis, a piece of computer code, and even a hotkey combination ⇧⌘A within the text.
<Text as="p">
Look, such a helpful <Link href="#">link</Link>, an <Em>italic emphasis</Em>,
a piece of computer <Code>code</Code>, and even a hotkey combination{" "}
<Kbd>⇧⌘A</Kbd> within the text.
</Text>
Checkbox(/themes/docs/components/checkbox), RadioGroup(/themes/docs/components/radio-group) 또는 Switch(/themes/docs/components/switch)와 같은 폼 컨트롤과 함께 Text를 조합하면 텍스트의 첫 번째 줄과 자동으로 정렬됩니다. 텍스트가 여러 줄일 때도 마찬가지입니다.
<Box maxWidth="300px">
<Text as="label" size="3">
<Flex gap="2">
<Checkbox defaultChecked /> 이 문서가 기밀이며 제3자와 공유할 수 없음을 이해합니다.
</Flex>
</Text>
</Box>