Anchor
Hyperlinks to scroll on one page.
When To Use#
For displaying anchor hyperlinks on page and jumping between them.
Examples
import { Anchor } from 'antd';
const { Link } = Anchor;
ReactDOM.render(
<Anchor>
<Link href="#components-anchor-demo-basic" title="Basic demo" />
<Link href="#components-anchor-demo-fixed" title="Fixed demo" />
<Link href="#API" title="API">
<Link href="#Anchor-Props" title="Anchor Props" />
<Link href="#Link-Props" title="Link Props" />
</Link>
</Anchor>
, mountNode);
import { Anchor } from 'antd';
const { Link } = Anchor;
ReactDOM.render(
<Anchor affix={false}>
<Link href="#components-anchor-demo-basic" title="Basic demo" />
<Link href="#components-anchor-demo-fixed" title="Fixed demo" />
<Link href="#API" title="API">
<Link href="#Anchor-Props" title="Anchor Props" />
<Link href="#Link-Props" title="Link Props" />
</Link>
</Anchor>
, mountNode);
API#
Anchor Props#
Property | Description | Type | Default |
---|---|---|---|
affix | Fixed mode of Anchor | boolean | true |
bounds | Bounding distance of anchor area | number | 5(px) |
offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - |
offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 |
showInkInFixed | Whether show ink-balls in Fixed mode | boolean | false |
Link Props#
Property | Description | Type | Default |
---|---|---|---|
href | target of hyperlink | string | |
title | content of hyperlink | string|ReactNode |