Typography
نمای کلیimport { Typography, TypographyGroup, TypographySpec, TypographyVariant } from '@nili/ui';این همان صفحهی نمای کلیِ خود کتابخانه است که زنده رندر میشود. زبان یا تم را از هدر عوض کنید، همراهش میآید.
Inter Display · عنوان
6 گونه. المان از روی خود گونه انتخاب میشود — h1 یک <h1> میسازد و paragraph-* یک <p> — پس ساختار سند بدون اینکه چیزی بپرسید درست میماند.
روباه قهوهای چابک میپرد
- گونه
- h1
- اندازه
- 56/64
- وزن
- 500
- فاصلهی حروف
- -0.4px
روباه قهوهای چابک میپرد
- گونه
- h2
- اندازه
- 48/56
- وزن
- 500
- فاصلهی حروف
- -0.4px
روباه قهوهای چابک میپرد
- گونه
- h3
- اندازه
- 40/48
- وزن
- 500
- فاصلهی حروف
- -0.4px
روباه قهوهای چابک میپرد
- گونه
- h4
- اندازه
- 32/40
- وزن
- 500
- فاصلهی حروف
- -0.4px
روباه قهوهای چابک میپرد
- گونه
- h5
- اندازه
- 24/32
- وزن
- 500
- فاصلهی حروف
- 0px
روباه قهوهای چابک میپرد
- گونه
- h6
- اندازه
- 20/28
- وزن
- 500
- فاصلهی حروف
- 0px
import { Typography } from "@nili/ui"
export function Example() {
return (
<>
<Typography variant="h1">The quick brown fox</Typography>
<Typography variant="h2">The quick brown fox</Typography>
<Typography variant="h3">The quick brown fox</Typography>
<Typography variant="h4">The quick brown fox</Typography>
<Typography variant="h5">The quick brown fox</Typography>
<Typography variant="h6">The quick brown fox</Typography>
</>
)
}Inter · برچسب
5 گونه. المان از روی خود گونه انتخاب میشود — h1 یک <h1> میسازد و paragraph-* یک <p> — پس ساختار سند بدون اینکه چیزی بپرسید درست میماند.
روباه قهوهای چابک میپرد
- گونه
- label-xlarge
- اندازه
- 24/32
- وزن
- 500
- فاصلهی حروف
- -0.4px
روباه قهوهای چابک میپرد
- گونه
- label-large
- اندازه
- 18/28
- وزن
- 500
- فاصلهی حروف
- -0.4px
روباه قهوهای چابک میپرد
- گونه
- label-medium
- اندازه
- 16/24
- وزن
- 500
- فاصلهی حروف
- 0px
روباه قهوهای چابک میپرد
- گونه
- label-small
- اندازه
- 14/20
- وزن
- 500
- فاصلهی حروف
- 0px
روباه قهوهای چابک میپرد
- گونه
- label-xsmall
- اندازه
- 12/16
- وزن
- 500
- فاصلهی حروف
- 0px
import { Typography } from "@nili/ui"
export function Example() {
return (
<>
<Typography variant="label-xlarge">The quick brown fox</Typography>
<Typography variant="label-large">The quick brown fox</Typography>
<Typography variant="label-medium">The quick brown fox</Typography>
<Typography variant="label-small">The quick brown fox</Typography>
<Typography variant="label-xsmall">The quick brown fox</Typography>
</>
)
}Inter · پاراگراف
5 گونه. المان از روی خود گونه انتخاب میشود — h1 یک <h1> میسازد و paragraph-* یک <p> — پس ساختار سند بدون اینکه چیزی بپرسید درست میماند.
روباه قهوهای چابک میپرد
- گونه
- paragraph-xlarge
- اندازه
- 24/32
- وزن
- 400
- فاصلهی حروف
- -0.4px
روباه قهوهای چابک میپرد
- گونه
- paragraph-large
- اندازه
- 18/28
- وزن
- 400
- فاصلهی حروف
- -0.4px
روباه قهوهای چابک میپرد
- گونه
- paragraph-medium
- اندازه
- 16/24
- وزن
- 400
- فاصلهی حروف
- 0px
روباه قهوهای چابک میپرد
- گونه
- paragraph-small
- اندازه
- 14/20
- وزن
- 400
- فاصلهی حروف
- 0px
روباه قهوهای چابک میپرد
- گونه
- paragraph-xsmall
- اندازه
- 12/16
- وزن
- 400
- فاصلهی حروف
- 0px
import { Typography } from "@nili/ui"
export function Example() {
return (
<>
<Typography variant="paragraph-xlarge">The quick brown fox</Typography>
<Typography variant="paragraph-large">The quick brown fox</Typography>
<Typography variant="paragraph-medium">The quick brown fox</Typography>
<Typography variant="paragraph-small">The quick brown fox</Typography>
<Typography variant="paragraph-xsmall">The quick brown fox</Typography>
</>
)
}Inter · زیرعنوان
4 گونه. المان از روی خود گونه انتخاب میشود — h1 یک <h1> میسازد و paragraph-* یک <p> — پس ساختار سند بدون اینکه چیزی بپرسید درست میماند.
روباه قهوهای چابک
- گونه
- subheading-medium
- اندازه
- 16/24
- وزن
- 500
- فاصلهی حروف
- 0.8px
روباه قهوهای چابک
- گونه
- subheading-small
- اندازه
- 14/20
- وزن
- 500
- فاصلهی حروف
- 0.8px
روباه قهوهای چابک
- گونه
- subheading-xsmall
- اندازه
- 12/16
- وزن
- 500
- فاصلهی حروف
- 0.4px
روباه قهوهای چابک
- گونه
- subheading-2xsmall
- اندازه
- 11/12
- وزن
- 500
- فاصلهی حروف
- 0.4px
import { Typography } from "@nili/ui"
export function Example() {
return (
<>
<Typography variant="subheading-medium">The quick brown fox</Typography>
<Typography variant="subheading-small">The quick brown fox</Typography>
<Typography variant="subheading-xsmall">The quick brown fox</Typography>
<Typography variant="subheading-2xsmall">The quick brown fox</Typography>
</>
)
}Inter · متن
3 گونه. المان از روی خود گونه انتخاب میشود — h1 یک <h1> میسازد و paragraph-* یک <p> — پس ساختار سند بدون اینکه چیزی بپرسید درست میماند.
روباه قهوهای چابک میپرد
- گونه
- body-large
- اندازه
- 18/32
- وزن
- 400
- فاصلهی حروف
- -0.4px
روباه قهوهای چابک میپرد
- گونه
- body-medium
- اندازه
- 16/28
- وزن
- 400
- فاصلهی حروف
- 0px
روباه قهوهای چابک میپرد
- گونه
- body-small
- اندازه
- 14/24
- وزن
- 400
- فاصلهی حروف
- 0px
import { Typography } from "@nili/ui"
export function Example() {
return (
<>
<Typography variant="body-large">The quick brown fox</Typography>
<Typography variant="body-medium">The quick brown fox</Typography>
<Typography variant="body-small">The quick brown fox</Typography>
</>
)
}Inter · مستندات
2 گونه. المان از روی خود گونه انتخاب میشود — h1 یک <h1> میسازد و paragraph-* یک <p> — پس ساختار سند بدون اینکه چیزی بپرسید درست میماند.
روباه قهوهای چابک میپرد
- گونه
- docs-label
- اندازه
- 18/32
- وزن
- 500
- فاصلهی حروف
- -0.4px
روباه قهوهای چابک میپرد
- گونه
- docs-paragraph
- اندازه
- 18/32
- وزن
- 400
- فاصلهی حروف
- -0.4px
import { Typography } from "@nili/ui"
export function Example() {
return (
<>
<Typography variant="docs-label">The quick brown fox</Typography>
<Typography variant="docs-paragraph">The quick brown fox</Typography>
</>
)
}تغییر المان
وقتی وزن بصری و معنای سمانتیک با هم نمیخوانند از as استفاده کنید — عنوان بخشی که نباید <h1> باشد، یا برچسبی که روی <span> رندر میشود.
import { Typography } from "@nili/ui"
export function Example() {
return (
<>
{/* Looks like H3, but is a section heading */}
<Typography variant="h3" as="h2">Section title</Typography>
{/* Label styling on an inline element */}
<Typography variant="label-small" as="span">Inline label</Typography>
{/* Any element, including a link */}
<Typography variant="paragraph-small" as="a" href="#">
Read the guidelines
</Typography>
</>
)
}Typography
extends TypographyVariantProps
محورهای واریانت — از تعریف cva کامپوننت
| پراپ | نوع | پیشفرض | توضیح |
|---|---|---|---|
| variant | h1 | h2 | h3 | h4 | h5 | h6 | label-xlarge | label-large | label-medium | label-small | label-xsmall | paragraph-xlarge | paragraph-large | paragraph-medium | paragraph-small | paragraph-xsmall | subheading-medium | subheading-small | subheading-xsmall | subheading-2xsmall | body-large | body-medium | body-small | docs-label | docs-paragraph | paragraph-medium |
بقیهی پراپها
| پراپ | نوع | پیشفرض | توضیح |
|---|---|---|---|
| children | ReactNode | — | |
| as | ElementType | — | Override the rendered element. Defaults to a semantically sensible tag for the variant (`h1` renders `<h1>`, `paragraph-*` renders `<p>`) so document outline and screen-reader navigation stay correct by default. |
| className | string | — |