Back to Ant Design

FloatButton

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

6.3.74.2 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

PropertyDescriptionTypeDefaultVersion
iconSet the icon component of buttonReactNode-
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-
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>-
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

FloatButton.Group

PropertyDescriptionTypeDefaultVersion
openWhether the menu is visible or not, use it with triggerboolean-
closeIconCustomize close button iconReact.ReactNode<CloseOutlined />
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>