Divider
Content separators: direction, label, spacing and design.
When to use
Divider separates parts of a document or activity on a single line. A horizontal line separates blocks and may have a caption, a vertical line separates adjacent links and buttons. For even spacing without a line, use Space or Flex.
The separator signature does not replace the document title: content creates a regular span. Keep the h2/h3 structure separate.
Line and signature
orientation selects horizontal/vertical and takes precedence over vertical. children specifies the text, number, or Svelte snippet of the horizontal line caption; in vertical mode the signature is not displayed.
| Problem | Setting | Example |
|---|---|---|
| Split paragraphs | Horizontal Divider | Horizontal separator |
| Add signature | children, titlePlacement |
Separator with signature |
| Change distance between blocks | size |
Indent size |
| Split actions in line | orientation="vertical" |
Vertical division |
| Change line appearance | variant |
Line options |
titlePlacement=start/end follows the direction of the text; center places the signature in the middle. RTL example shows logical edges. plain leaves the usual signature design in place of the more prominent separator text.
size controls the vertical padding of the horizontal divider, not the line thickness. The local size takes precedence over the ConfigProvider's explicitly specified global size. variant selects solid/dashed/dotted; dashed also includes a dashed line.
Design and theme
Root has role=separator and aria-orientation. Without a signature, it simultaneously serves as a line; with the signature two rail and content appear. For line thickness and color, use styles.rail, taking into account both parts of it.
classNames/styles accept an object or function from info.props; styles contains CSS strings. Allowed orientation, titlePlacement and size are available in callback. Semantic slots show spot decoration without changing the content.
ConfigProvider.divider inherits class, style, classNames and styles. A nested record replaces the corresponding parent object; local styles are applied after inherited ones. theme.components.Divider is connected to the component: orientationMargin sets the fraction of the distance to the edge, textPaddingInline — the caption indent, verticalMarginInline — the intervals of the vertical divider.
bind:nativeElement returns the root div after mount. The separator itself is not an action or keyboard focus point; buttons and links inside their own snippet retain their semantics.
prefixCls specifies the full local CSS prefix and takes precedence over ConfigProvider.prefixCls. The empty string and undefined inherit a common prefix with the suffix -divider, defaulting to ant-divider. CSS variables, common marker and semantic slots names are preserved. Example ConfigProvider shows inheritance along with Flex and Segmented.
Divider uses design tokens from the current theme for its appearance.
Examples
First, select the components for your interface.
Then customize the theme and check availability.
The examples use the public package @woodger/antd.
Horizontal divider
A line separates paragraphs in a document; dashed is retained as a compatible way to specify dashes.
<script lang="ts">
import { Divider } from '@woodger/antd';
</script>
<p>{("First, select the components for your interface.")}</p>
<Divider />
<p>{("Then customize the theme and check availability.")}</p>
<Divider dashed />
<p>{("The examples use the public package @woodger/antd.")}</p>
Separator with label
titlePlacement specifies the logical start, center, or end. The label may be Svelte snippet.
<script lang="ts">
import { Divider } from '@woodger/antd';
</script>
<Divider titlePlacement="start">{("Home")}</Divider>
<Divider>{("Center")}</Divider>
<Divider titlePlacement="end">{("End")}</Divider>
<Divider titlePlacement="start">
<span>{("Stage ")}<strong>02</strong></span>
</Divider>
small
Next paragraph
medium
Next paragraph
large
Next paragraph
Indent size
small, medium and large change the vertical spacing of the horizontal line, not its thickness.
<script lang="ts">
import { Divider } from '@woodger/antd';
</script>
<div
aria-label={("Small interval")}
><p>small</p><Divider
size="small"
/><p>{("Next paragraph")}</p></div>
<div
aria-label={("Average interval")}
><p>medium</p><Divider
size="medium"
/><p>{("Next paragraph")}</p></div>
<div aria-label={("Large interval")}><p>large</p><Divider size="large" /><p>
{("Next paragraph")}
</p></div>
Plain label text
plain removes the header design. The switch allows you to compare both types of one label.
<script lang="ts">
import { Divider } from '@woodger/antd';
let plain = $state(false);
</script>
<label><input type="checkbox" bind:checked={plain} />{(" Regular label")}</label>
<Divider {plain}>{("Additional information")}</Divider>
Vertical split
A vertical line separates short actions in a line. The children text is not displayed when vertical.
<script lang="ts">
import { Divider } from '@woodger/antd';
</script>
<div>
<a
href={("/contacts")}
>{("Contacts")}</a><Divider
orientation="vertical"
/>
<a href={("/ant-design")}>{("Overview")}</a><Divider vertical />
<span>{("Project settings")}</span>
</div>
Line options
Solid, dashed and dotted lines with and without label.
<script lang="ts">
import { Divider } from '@woodger/antd';
</script>
{#each ['solid', 'dashed', 'dotted'] as variant (variant)}
<Divider variant={variant as 'solid' | 'dashed' | 'dotted'}>{(variant)}</Divider>
<Divider variant={variant as 'solid' | 'dashed' | 'dotted'} />
{/each}
Semantic slots
root, rail and content are issued separately. The styles function receives normalized props, including the position of the label.
<script lang="ts">
import { Divider } from '@woodger/antd';
</script>
<Divider titlePlacement="start"
classNames={{ root: 'custom-divider' }}
styles={({ props }) => ({
root: 'border-color:#722ed1',
rail: `
border-color: #722ed1;
border-width: 2px 0 0;
`,
content: `
color: #722ed1;
padding-inline: 12px;
${props.titlePlacement === 'start' ? 'margin-inline-start: 0;' : ''}
`
})}
>{("Agreed section")}</Divider>
<Divider styles={{
root: 'margin-block:16px',
rail: 'border-color:#08979c'
}} />
Text direction
Boolean start follows the direction of ConfigProvider. Switching does not require changing the titlePlacement.
<script lang="ts">
import { ConfigProvider, Divider } from '@woodger/antd';
let rtl = $state(false);
</script>
<label><input type="checkbox" bind:checked={rtl} />{(" Right to left")}</label>
<ConfigProvider direction={rtl ? 'rtl' : 'ltr'}>
<Divider titlePlacement="start">{("Start of section")}</Divider>
</ConfigProvider>
A separator separates content and inherits the theme, size and direction.
Project sections
The original review example retains the choice of position, line and text design.
<script lang="ts">
import { Divider, type DividerTitlePlacement } from '@woodger/antd';
let placement = $state<DividerTitlePlacement>('start');
let variant = $state<'solid' | 'dashed' | 'dotted'>('solid');
let plain = $state(false);
</script>
<style>
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
}
.controls label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
<div class="controls">
<label>{("Label ")}<select bind:value={placement}>
<option value="start">
{("At the beginning")}
</option>
<option
value="center"
>{("In the center")}</option>
<option
value="end"
>{("At the end")}</option>
</select></label>
<label>{("Line ")}<select bind:value={variant}>
<option value="solid">
{("Solid")}
</option>
<option
value="dashed"
>{("Lined")}</option>
<option
value="dotted"
>{("Spot")}</option>
</select></label>
<label><input type="checkbox" bind:checked={plain} />{(" Plain text")}</label>
</div>
<Divider titlePlacement={placement} {variant} {plain}>{("Project sections")}</Divider>
<p>{("A separator separates content and inherits the theme, size and direction.")}</p>
<Divider {variant} />
<div>{("Overview")}<Divider
orientation="vertical"
{variant}
/>{("Members")}<Divider
vertical
{variant}
/>{("Settings")}</div>
API
Themes of the ant.design live page are mapped to the public API of the installed package. Full definitions of Props are in @woodger/antd.
| Theme | Example or limitation |
|---|---|
| Horizontal | Regular and dashed line between paragraphs. |
| Divider with title | Start, center, end and snippet. |
| Set the spacing size of the divider | Three intervals. |
| Text without heading style | Switching plain. |
| Vertical | Actions in line. |
| Variant | solid/dashed/dotted. |
| Custom semantic dom styling | Working design of slots. |
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Full local CSS prefix. The empty string inherits the common prefix; ant-divider is used without configuration. Semantic slots and CSS variables preserve names. | string | ConfigProvider + -divider |
orientation | Line direction. The position of the label is set via titlePlacement. | horizontal | vertical | horizontal |
vertical | Short record of vertical direction. Explicit orientation takes precedence. | boolean | false |
titlePlacement | start/end follow direction; left/right remain physical sides. | start | center | end | left | right | center |
children | Horizontal line label. | Snippet | string | number | null | false | — |
size | Vertical margins of the horizontal separator. | small | medium | large | From ConfigProvider |
variant | Line view. dashed=true also includes dashes. | solid | dashed | dotted | solid |
plain | Label without title design. | boolean | false |
classNames | The root, rail and content classes. | DividerSemanticSlots | function | — |
styles | CSS lines for the same slots. The function receives info.props. | DividerSemanticSlots | function | — |
nativeElement | bind:nativeElement for the root element. | HTMLDivElement | — |
Semantic DOM
root - div with role="separator" and aria-orientation. With the label inside there are two lines rail and span content. Without root label, rail simultaneously serves. The vertical separator does not output content.
classNames/styles accept an object or function from info.props. ConfigProvider.divider inherits class/style and semantic slots; local styles take precedence. direction and the explicitly specified overall size are also inherited.
Registration tokens
Component tokens orientationMargin (fraction of distance to edge), textPaddingInline and verticalMarginInline are applied via theme.components.Divider. Local styles specify the design after the theme and provider settings.
| Token | Current value |
|---|---|
colorSplit | rgba(5,5,5,0.06) |
colorText | rgba(0,0,0,0.88) |
colorTextHeading | rgba(0,0,0,0.88) |
fontFamily | -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji' |
fontSize | 14 |
fontSizeLG | 16 |
lineHeight | 1.5714285714285714 |
lineWidth | 1 |
margin | 16 |
marginLG | 24 |
marginXS | 8 |
FAQ
Why doesn't size make the line thicker?
size changes the indentation. Set the thickness via styles.rail; when signing, it is applied to two lines.
How to position a signature taking into account RTL?
Use titlePlacement=start/end. The logical edge follows the direction of the text.
Does the caption replace the section heading?
No, content is a regular span. Specify document headings separately.