logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
YouMindTRACTIANLobeHubCodeRabbit
6.5.0
  • Components Overview
  • Changelog
    v6.5.0
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
      DEPRECATED
    • Popover
    • QRCode
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • BorderBeam
      6.4.0
    • ConfigProvider
    • Util
When To Use
Examples
Basic
Type
Shape
Content
FloatButton with tooltip
FloatButton Group
Menu mode
Controlled mode
placement
draggable
BackTop
badge
Custom semantic dom styling
API
common API
FloatButton.Group
FloatButton.BackTop
Semantic DOM
FloatButton
FloatButton.Group
Design Token

FloatButton

A button that floats at the top of the page.
Importimport { FloatButton } from 'antd';
GitHub
components/float-buttonIssueOpen issues
Docs
Edit this pageLLMs.md
ButtonIcon

Resources

Ant Design X
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
X
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
For Agents
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

When To Use

  • For global functionality on the site.
  • Buttons that can be seen wherever you browse.

Examples

API

Common props ref:Common props

This component is available since antd@5.0.0.

common API

PropertyDescriptionTypeDefaultVersionGlobal Config
iconSet the icon component of buttonReactNode-FloatButton: ×, BackTop: 5.27.0
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.0
contentText and otherReactNode-×
descriptionPlease use content insteadReactNode-×
tooltipThe text shown in the tooltipReactNode | TooltipProps-TooltipProps: 5.25.0×
typeSetting button typedefault | primarydefault×
shapeSetting button shapecircle | squarecircle×
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-6.0.0
onClickSet the handler to handle click event(event) => void-×
hrefThe target of hyperlinkstring-×
targetSpecifies where to display the linked URLstring-×
htmlTypeSet the original html type of button, see: MDNsubmit | reset | buttonbutton5.21.0×
badgeAttach Badge to FloatButton. status and other props related are not supported.BadgeProps-5.4.0×
disabledWhether the button is disabledboolean-6.4.0×

FloatButton.Group

PropertyDescriptionTypeDefaultVersionGlobal Config
openWhether the menu is visible or not, use it with triggerboolean-×
closeIconCustomize close button iconReact.ReactNode<CloseOutlined />5.16.0
placementCustomize menu animation placementtop | left | right | bottomtop5.21.0×
shapeSetting button shape of childrencircle | squarecircle×
triggerWhich action can trigger menu open/closeclick | hover-×
onOpenChangeCallback executed when active menu is changed, use it with trigger(open: boolean) => void-×
onClickSet the handler to handle click event (only work in Menu mode)(event) => void-5.3.0×

FloatButton.BackTop

PropertyDescriptionTypeDefaultVersion
durationTime to return to top(ms)number450
targetSpecifies the scrollable area dom node() => HTMLElement() => window
visibilityHeightThe BackTop button will not show until the scroll height reaches this valuenumber400
onClickA callback function, which can be executed when you click the button() => void-

Semantic DOM

FloatButton

FloatButton.Group

Design Token

Global TokenHow to use?
Token NameDescriptionTypeDefault Value
colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
borderRadiusBorder radius of base componentsnumber6
borderRadiusLGLG size border radius, used in some large border radius components, such as Card, Modal and other components.number8
boxShadowSecondaryControl the secondary box shadow style of an element.string 0 6px 16px 0 rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12), 0 9px 28px 8px rgba(0,0,0,0.05)
controlHeightThe height of the basic controls such as buttons and input boxes in Ant Designnumber32
controlHeightLGLG component heightnumber40
fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-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'
fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
fontSizeIconControl the font size of operation icon in Select, Cascader, etc. Normally same as fontSizeSM.number12
fontSizeSMSmall font sizenumber12
lineHeightLine height of text.number1.5714285714285714
marginLGControl the margin of an element, with a large size.number24
marginXXLControl the margin of an element, with the largest size.number48
motionDurationMidMotion speed, medium speed. Used for medium element animation interaction.string0.2s
motionDurationSlowMotion speed, slow speed. Used for large element animation interaction.string0.3s
paddingControl the padding of the element.number16
paddingXXSControl the extra extra small padding of the element.number4
zIndexPopupBaseBase zIndex of component like FloatButton, Affix which can be cover by large popupnumber1000
Basic

The most basic usage.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Shape

Change the shape of the FloatButton with the shape property.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
FloatButton with tooltip

Setting the tooltip property shows the FloatButton with a tooltip.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Menu mode

Open menu mode with trigger, which could be hover or click.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
placement

Customize animation placement, providing four preset placement: top, right, bottom, left, the top position by default.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
5.21.0
BackTop

BackTop makes it easy to go back to the top of the page.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Custom semantic dom styling

You can customize the semantic dom style of FloatButton by passing objects/functions through classNames and styles.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
6.0.0
Type

Change the type of the FloatButton with the type property.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Content

Setting the content property allows you to show a FloatButton with a description.

supported only when shape is square. Due to narrow space for text, short sentence is recommended.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
FloatButton Group

When multiple buttons are used together, <FloatButton.Group /> is recommended. By setting the shape property of FloatButton.Group, you can change the shape of group. The shape of the FloatButton.Group will override the shape of FloatButtons inside.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Controlled mode

Set the component to controlled mode through open, which need to be used together with trigger.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
draggable

Implement drag-and-drop functionality with third-party libraries.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
badge

FloatButton with Badge.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
  • root
    Root element with float button base styles, shape size, type theme, fixed positioning, z-index, shadow, spacing and other container styles
  • icon
    Icon element with button icon size, color, line height, alignment and other icon display styles
  • content
    Content element with button text content font size, color, alignment, line wrap and other text display styles
  • root
    Root element with float button group container styles, fixed positioning, z-index, padding, gap, direction mode and other combined layout styles
  • list
    List element with button group list flex layout, border radius, shadow, animation transition, vertical alignment and other list container styles
  • item
    Item element with individual float button styles, size, shape, type, state, icon content and other button base styles
  • itemIcon
    Item icon element with float button icon size, color, alignment and other icon display styles
  • itemContent
    Item content element with float button text content, badge, description and other content area styles
  • trigger
    Trigger element with menu mode trigger button styles, shape, icon, hover state, expand/collapse state and other interaction styles
  • triggerIcon
    Trigger icon element with trigger button icon styles, rotation animation, toggle state and other icon interaction styles
  • triggerContent
    Trigger content element with trigger button content area text, identifier, state indicator and other content styles