Ant Design Svelte

Typography

Text, headings and links with copying, editing and shortening.

When to use

Typography designs documents, headings, signatures, links and paragraphs with copying, editing or shortening text. Choose an option based on semantics: TypographyTitle creates a title of the required level, TypographyText - a line fragment, TypographyParagraph - a block of text, TypographyLink - a real link.

Regular Typography creates an article by default and can wrap an entire document. A simple native table inside a document is appropriate without interactive Table.

Options and contents

Typography, TypographyText, TypographyTitle, TypographyParagraph and TypographyLink are exported to Svelte. children accepts text, an array of content, or a snippet. For text operations, keep the source string in application state.

Problem Setting Example
Create a document Typography, TypographyTitle, TypographyParagraph Document with typography
Select title level TypographyTitle.level Heading levels
Design line and link TypographyText, TypographyLink Text and links
Let me change the line editable Editing text
Add copy copyable Copy text

type specifies secondary/success/warning/danger. code, mark, keyboard, underline, delete, strong and italic change the appearance; strong is missing from TypographyTitle. disabled here styles the text, but does not automatically disable the action buttons. The link retains its href, target, and native behavior.

Editing and copying

editable.onChange reports a string to assign to the state and pass it back to children. bind:value is missing. For a managed editor, set editable.editing and accept onStart/onEnd/onCancel; callbacks themselves do not rewrite your text. Guided Example stores the mode and result separately.

maxLength and autoSize configure the edit field, triggerType selects triggering by icon or text. actions.placement places operations at start/end. Icons and tooltip content accept text or Svelte snippets; action position shown separately.

copyable=true uses the original content text; for a complex snippet, set explicit copyable.text. This property also accepts an asynchronous function. This function is called when clicked; asynchronous example gets the current string for the buffer. Format distinguishes between text/plain and text/html, onCopy reports the completion of the operation. For HTML, pass the desired string explicitly rather than waiting for the snippet markup to be automatically exported.

Abbreviation and formatting

TypographyText shrinks to one line and does not automatically fill the entire width: set the width constraint. TypographyParagraph/TypographyTitle support rows, expandable and collapsible, suffix and expanded/onExpand controls. defaultExpanded specifies only the initial expansion; onEllipsis reports the fact of reduction.

Shortening Long Text shows different widths and lines. Controlled disclosure stores expanded separately. To expand the file name, put the tail in suffix; tooltip and copy can use the full source string.

Scalar fragments and the children array preserve the text boundaries for the dimension; snippet is considered a single node. Check the reduction after changing the width and content in the browser. Whether the reduction occurs depends on the size of the DOM.

classNames/styles support root, actions, action and textarea object or function from props. styles - CSS strings; ConfigProvider.typography sets the defaults of the family. Semantic example shows the working design. The theme.components.Typography component design tokens set the header indentation; titleMarginTop operates on adjacent blocks provided by typography, and not on any arbitrary title. Shimmer from the 6.7 documentation has not been carried over.

Action buttons have locale accessible names. bind:nativeElement points to the current element, but is absent during editing. Do not use a link to the old node after switching to the editor.

All variants of the family support prefixCls. A non-empty value specifies the full local prefix; empty string and undefined use ConfigProvider.prefixCls with the -typography suffix. Each nested variant selects its own prefix: the local Typography.prefixCls is not passed to TypographyText automatically. The prefix covers decorations, ellipsis, operations, and a separate editor root. Example of prefixes preserves draft, selection, focus, and copy success when updating classes. The Namespace of the theme variables and the prefix of the nested Tooltip are set independently.

In the Ant Design 6.6.8 standard, the copy/edit actions when changing the prefix can preserve the previous classes due to memoization. Svelte updates them with the root; this is a conscious difference from this behavior of the standard.

Examples

Project setup

Install the package and connect the styles. The general provider specifies the color, size, and density of the components.

Operating procedure

  1. Select a component.
  2. Adjust settings.
  3. Check the result in the browser.
The example state is stored in the Svelte component.
npm install @woodger/antd
Questions about the project can be asked at contact page .

Document with typography

Typography designs an article with headings, paragraphs, lists, quotes and inline code.

Level header 1

Level header 2

Level header 3

Level header 4

Level header 5

Heading levels

level=1…5 creates a real h1…h5. Choose a level based on the structure of the document.

Plain text Secondary text Operation completed Check required Operation error Inaccessible text Marker highlighting npm install @woodger/antd Enter Underlined Remote Bold Italic Contacts in a new tab

Text and links

Color states, highlighting, code, keys and native link. disabled specifies the typography.

Section name

Section name

Text editing

editable.onChange accepts the saved text. Enter saves, Escape cancels, loss of focus saves input.

Release Note

No events

Guided Editing

Click on the text to edit. editing is controlled by the application; callbacks show the stages, maxLength and autoSize configure the editor.

hello@woodger.org
Installation command

0

Copy text

copyable copies the displayed or separately specified text. Tooltip and icons change after successful copying.

Current release information

Asynchronous text for buffer

The text function is called when clicked and can return a Promise. The displayed label remains separate from the copied line.

Text with actions

Action position

actions.placement places edit/copy before or after the text. Switching does not change the saved value.

Документация проекта содержит описание компонентов, примеры использования и параметры API. Сначала выберите нужный компонент, затем проверьте его поведение в светлой и тёмной теме. Исходный код каждой карточки можно раскрыть и скопировать в своё приложение. Общие настройки размера, цвета и плотности сохраняются между страницами.
Документация проекта содержит описание компонентов, примеры использования и параметры API. Сначала выберите нужный компонент, затем проверьте его поведение в светлой и тёмной теме. Исходный код каждой карточки можно раскрыть и скопировать в своё приложение. Общие настройки размера, цвета и плотности сохраняются между страницами.

Shortening long text

Text is reduced to one line at a given width; Paragraph supports multiple lines, expansion and Tooltip.

Документация проекта содержит описание компонентов, примеры использования и параметры API. Сначала выберите нужный компонент, затем проверьте его поведение в светлой и тёмной теме. Исходный код каждой карточки можно раскрыть и скопировать в своё приложение. Общие настройки размера, цвета и плотности сохраняются между страницами.

Collapsed

Controlled opening

expanded and onExpand are connected to the Svelte state. The collapsible mode allows you to collapse the text again; the external button resets the opening.

documentation-components-implementation-examples-release-notes-2026.md

Cut from the middle

The beginning of the line is transferred to children, the unchanged tail is transferred to suffix. This way the file name extension remains visible.

Документация проекта содержит описание компонентов, примеры использования и параметры API. Сначала выберите нужный компонент, затем проверьте его поведение в светлой и тёмной теме. Исходный код каждой карточки можно раскрыть и скопировать в своё приложение. Общие настройки размера, цвета и плотности сохраняются между страницами. — руководство

Abbreviated paragraph suffix

The suffix remains with the abbreviated text. The original full line without a service label was sent for copying.

Release plan
StageResponsible
DevelopmentAnna
DocumentationBoris

Native table in the document

Typography designs a regular table. For sorting, row selection, and pagination, use the Table component.

Оформление Typography

Semantic slots and provider

ConfigProvider.typography sets the general design. The local function styles and classNames change root/actions/action/textarea, preserving the original operations.

Document with prefix

Document title

Designed text To the example status Long string is shortened regardless of prefix
Draft document
Neighboring area neighbor
General: suite; class: project-typography; No changes; copies: 0; text: Draft document

The local prefix is ​​passed to each option separately. The editor and actions update classes along with the text; Tooltip chooses its prefix independently.

Text and editor prefixes

All Typography options, abbreviations and operations use a local or shared prefixCls. The change preserves the editor and copy state.

Text, headings and links

Plain text Secondary Success Warning Error Selection npm install @woodger/antd Enter Component Gallery
This text can be edited directly on the page.
Ant Design для Svelte объединяет типизированные компоненты, доступные элементы управления и общие настройки оформления. Длинный текст можно свернуть до двух строк, а затем раскрыть целиком, сохранив контекст страницы и расположение остальных примеров.

Project text

Initial example from the review: design, link, editing, copying and collapsible description.

API

Eleven ant.design live page themes mapped to the available Svelte API. Full Props definitions belong to the package; The table shows the main parameters of the operations.

Topics of official examples
ThemeExample or limitation
BasicArticle, list, quote and code.
Title ComponentReal h1…h5.
Text and Link ComponentColors, decorations and native links.
Shimmer Textshimmer was introduced in React 6.7.0; not present in the installed package.
EditableAdditionally, controlled editing, callbacks and placement actions are shown.
CopyablePlain and separately specified text; an additional example returns a Promise.
EllipsisSingle and multiple lines, Tooltip and expansion.
Controlled ellipsis expand/collapseControlled expanded and external reset.
Ellipsis from middleStored tail of the file name via suffix.
suffixParagraph with suffix and copying of the full text.
TableDesign of native table inside Typography.
CSS prefixGeneral and local prefixes of all variants; maintaining a draft, focus and successful copying.
General parameters Text, Title, Paragraph and Link
PropertyDescriptionTypeDefault
prefixClsFull local prefix for text, design, actions, and editor. The empty string and undefined use the provider prefix.stringConfigProvider.prefixCls + "-typography"
childrenStrings, numbers, arrays and Svelte snippets. For copy and reduce operations, the source string is important.TypographyContent—
editableEditor and callbacks. The application saves the new row in onChange.boolean | TypographyEditConfigfalse
copyableCopying the original or separately specified text; text can be an asynchronous function.boolean | TypographyCopyConfigfalse
ellipsisParagraph and Title support rows and expansion. Text has no rows, expandable, or onExpand. link accepts a boolean only. tooltip.alignPoint anchors the tooltip to the pointer coordinates.boolean | TypographyEllipsisConfigfalse
actionsPosition of the edit/copy/expand panel relative to the text.{ placement: start | end }end
typeText color. disabled specifies the design; it does not disable action handlers.secondary | success | warning | dangerRegular color
codeMonospace design. Mark, keyboard, underline, delete, strong and italic are also available; strong is missing from Title.booleanfalse
classNamesClasses root, actions, action and textarea, object or function from info.props.TypographySemantic—
stylesCSS lines for the same slots. Local values ​​override ConfigProvider.typography.TypographySemantic—
nativeElementbind:nativeElement returns the current HTML element; when going to the editor it is missing.HTMLElement—

Family options

Typography creates an article, component changes the native container. TypographyTitle uses level=1...5, TypographyText - span, TypographyParagraph - div with indent, TypographyLink - a with href. target="_blank" gets rel="noopener noreferrer" if rel is not specified explicitly.

editable

text specifies the source text of the editor; editing enables managed mode. onStart, onChange, onCancel and onEnd communicate start, save, cancel and end via Enter. In controlled mode, the owner changes editing and children independently. maxLength, autoSize, triggerType, icon, tooltip, enterIcon and tabIndex configure the editor and its launch.

copyable

text - string or function with Promise; empty value uses children. icon and tooltips can specify normal and successful states. tooltips=false hides tooltips, tabIndex controls Tab order. format selects text/plain or text/html, onCopy is called after successful copying.

ellipsis

rows limits the rows, expandable=true allows you to expand, collapsible - expands and collapses. expanded/onExpand control the state, defaultExpanded sets the start. suffix remains with the abbreviated text, symbol changes the action label, tooltip shows the full line, onEllipsis reports the fact of abbreviation.

Semantic DOM

root - current container; actions — operations panel; action - each button; textarea - editor field. The classNames/styles objects and functions are available both locally and through ConfigProvider.typography. styles accepts CSS strings.

Headings retain h1...h5, links - native a. Operations are performed by buttons with names from locale or tooltips. When editing, focus goes to the textarea: Enter saves, Shift+Enter adds a line, Escape cancels, blur saves.

The family does not have separate focus()/blur() instances. For a native element there is bind:nativeElement; during editing, the main element is replaced by the editor.

Each Typography variant chooses its own prefixCls: the local article prefix is ​​not passed to the nested TypographyText automatically. The prefix covers text, decorations, ellipsis, actions and editor; Theme namespace and Tooltip prefix are independent. When changing the prefix, the current mode's DOM, draft, and copy state are preserved.

Registration tokens

Two component tokens are checked against ant.design and ComponentTokenMap. theme.components.Typography applies header indentation in appropriate typographic states. Local styling is specified by ConfigProvider.typography and semantic styles, as in design card.

Typography Component Tokens
TokenPurpose
titleMarginTopHeader top indent.
titleMarginBottomBottom header indent.

Common tokens of the current topic

theme.useToken() values react to section settings.

Common tokens of the current topic
TokenCurrent value
colorErrorText#ff4d4f
colorErrorTextActive#d9363e
colorErrorTextHover#ff7875
colorFillAlterrgba(0,0,0,0.02)
colorIconrgba(0,0,0,0.45)
colorLink#1677ff
colorLinkActive#0958d9
colorLinkHover#69b1ff
colorPrimaryBorder#adc6ff
colorSplitrgba(5,5,5,0.06)
colorSuccess#52c41a
colorSuccessText#52c41a
colorTextrgba(0,0,0,0.88)
colorTextDescriptionrgba(0,0,0,0.45)
colorTextDisabledrgba(0,0,0,0.25)
colorTextHeadingrgba(0,0,0,0.88)
colorWarningText#faad14
borderRadiusLG8
fontFamilyCode'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace
fontSize14
fontSizeHeading138
fontSizeHeading230
fontSizeHeading324
fontSizeHeading420
fontSizeHeading516
fontWeightStrong600
lineHeight1.5714285714285714
lineHeightHeading11.2105263157894737
lineHeightHeading21.2666666666666666
lineHeightHeading31.3333333333333333
lineHeightHeading41.4
lineHeightHeading51.5
lineTypesolid
lineWidth1
lineWidthFocus3
linkDecorationnone
linkFocusDecorationnone
linkHoverDecorationnone
marginXS8
marginXXS4
motionDurationMid0.2s
motionDurationSlow0.3s
padding16
paddingSM12

FAQ

Why is the changed text not saved?

Accept a string from editable.onChange into the state and pass it to children. Editing mode and content are controlled separately.

Why doesn't TypographyText shrink when changing width?

Inline TypographyText needs an explicit width. For multiple lines and expansion, use TypographyParagraph or TypographyTitle.

How to save the file name extension?

Pass the tail of the string to suffix. For tooltip and copy, you can leave the full original name.

Do I need to replace the native table with Table?

For a simple document table, the table inside Typography is sufficient. Table is needed for sorting, filters, row selection and pagination.