Back to Ant Design

FloatButton

components/float-button/index.en-US.md

6.4.44.6 KB
Original Source

When To Use

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

Examples

<!-- prettier-ignore -->

<code src="./demo/basic.tsx" iframe="360">Basic</code> <code src="./demo/type.tsx" iframe="360">Type</code> <code src="./demo/shape.tsx" iframe="360">Shape</code> <code src="./demo/content.tsx" iframe="360">Content</code> <code src="./demo/tooltip.tsx" iframe="360">FloatButton with tooltip</code> <code src="./demo/group.tsx" iframe="360">FloatButton Group</code> <code src="./demo/group-menu.tsx" iframe="360">Menu mode</code> <code src="./demo/controlled.tsx" iframe="360">Controlled mode</code> <code src="./demo/placement.tsx" iframe="380" version="5.21.0">placement</code> <code src="./demo/back-top.tsx" iframe="360">BackTop</code> <code src="./demo/badge.tsx" iframe="360">badge</code> <code src="./demo/badge-debug.tsx" iframe="360" debug>debug dot</code> <code src="./demo/style-class.tsx" iframe="360" version="6.0.0">Custom semantic dom styling</code> <code src="./demo/render-panel.tsx" debug>_InternalPanelDoNotUseOrYouWillBeFired</code>

API

Common props ref:Common props

This component is available since [email protected].

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

<code src="./demo/_semantic.tsx" simplify="true"></code>

FloatButton.Group

<code src="./demo/_semantic_group.tsx" simplify="true"></code>

Design Token

<ComponentTokenTable component="FloatButton"></ComponentTokenTable>