Typography
Typography コンポーネントは、アプリケーション全体で標準化されたテキストスタイルを提供します。
いつ使用するか
- 記事/ブログ/ノートなどでタイトルや段落の内容を表示する必要がある場合。
- コピー可能/編集可能/省略記号(...)付きのテキストが必要な場合。
使用例
タイトルコンポーネント
異なるレベルでタイトルを表示します。
H1 Heading
H2 Heading
H3 Heading
---
import Typography from '@/components/general/Typography.astro';
---
<Typography as="h1" variant="h1">H1 Heading</Typography>
<Typography as="h2" variant="h2">H2 Heading</Typography>
<Typography as="h3" variant="h3">H3 Heading</Typography> テキストコンポーネント
複数のタイプのテキストを提供します。
Most fonts have a particular weight which corresponds to one of the numbers in Common weight name mapping. However some fonts, called variable fonts, can support a range of weights with a more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight.
Most fonts have a particular weight which corresponds to one of the numbers in Common weight name mapping. However some fonts, called variable fonts, can support a range of weights with a more or less fine granularity.
Most fonts have a particular weight which corresponds to one of the numbers in Common weight name mapping.
Most fonts have a particular weight which corresponds to one of the numbers in Common weight name mapping.
---
import Typography from '@/components/general/Typography.astro';
---
<Typography as="p" variant="body">Body text...</Typography>
<Typography as="p" variant="body-heavy">Bold body text...</Typography>
<Typography as="p" variant="body-small">Small body text...</Typography>
<Typography as="p" variant="body-small-heavy">Small bold body text...</Typography> ポリモーフィズム
asの視覚的スタイルを維持しながら、任意の有効なHTML要素としてコンポーネントをレンダリングするためにvariantプロパティを使用できます。
---
import Typography from '@/components/general/Typography.astro';
---
<Typography as="span" variant="h1">Span looking like H1</Typography> API
| プロパティ | 説明 | タイプ | デフォルト |
|---|---|---|---|
| as | レンダリングするHTML要素またはコンポーネント。 | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'a' | 'div' | 'p' |
| variant | タイポグラフィの視覚的スタイルバリアント。 | 'h1' | 'h2' | 'h3' | 'body' | 'body-heavy' | 'body-small' | 'body-small-heavy' | 'body' |
| class | 適用する追加のCSSクラス。 | string | - |