FloatButton
Floating actions, drop-down groups and return to the beginning with progress.
When to use
FloatButton makes a common action available while scrolling: help, feedback or return to the beginning. FloatButtonGroup groups related actions; FloatButtonBackTop watches the scrolling of the selected area.
Components are imported separately. In the examples, the buttons are located inside local areas so that the demos do not overlap the site menu. In an application, the standard fixed position refers to the viewport.
FloatButton CSS Prefixes show global ConfigProvider.prefixCls and local prefixCls without resetting state. A child button without prefixCls inherits Group; an empty line selects ConfigProvider. BackTop and Progress retain independent settings. The buttons are limited to the example area.
Action and group
FloatButton creates a native button or link with an href. type selects default/primary, shape selects circle/square, icon and content specify the icon and caption. For an icon-only button, give it an accessible name.
| Problem | Setting | Example |
|---|---|---|
| Show single action | FloatButton, onclick |
Floating action |
| Add a signature or link | content, href |
Content and link |
| Merge Actions | FloatButtonGroup.items |
Action group |
| Expand menu | trigger, open, onOpenChange |
Controlled disclosure |
| Follow the Scroll | FloatButtonBackTop.target |
Return to the beginning of the container |
items of the group contains unique key and children snippets. The overall shape is inherited by child buttons; the content, type, and handler are specified by the actions themselves. Without trigger, the group shows the usual set of buttons. trigger=click/hover enables a dropdown menu.
With managed open, take the new value from onOpenChange. placement sets the opening direction, closeIcon — the closing icon. Selecting a child action does not automatically close the menu: if the script needs it, update the open in the handler. Menu compares clicking and hovering.
Return to the beginning and position
BackTop follows window by default and appears after visibilityHeight=400. Local target returns Window, Document, HTMLElement or null. null means the container is not yet ready and is not replaced by window. If visibilityHeight=0, the button is visible immediately after the area is ready.
duration specifies the return duration, default is 450 ms. With reduced motion, animation is not used. showProgress adds a scrolling progress ring; ring example shows it regardless of other actions.
target defines the watchable area, and CSS defines the position of the button. To limit it to a card, the examples create a relative container and place an absolutely button. In the application, match the inset and z-index with the header and other floating layers. Changing target does not make the fixed position snap to its bounds.
Tips and design
Tooltip accepts the contents or Tooltip settings without children. Badge adds a counter or dot; Badge status mode does not apply to this setting. Counter and point are shown side by side.
classNames/styles are available for button and group; styles contains CSS strings, and callbacks receive props. Slots groups include list, elements, and trigger. Semantic example shows local decoration and ConfigProvider.floatButtonGroup.
ConfigProvider.floatButton has backTopIcon running. The rest of its design fields are accepted by the types, but the installed FloatButton does not yet read them; use local props. FloatButton named component design tokens have not yet been published, theme.components.FloatButton is not connected. General colors and sizes are inherited from the theme.
Buttons retain the native keyboard and disabled state. BackTop has no bind:nativeElement until the button is visible. Determine the availability of an action by its state and handler, and not just by the visibility of the tooltip.
Examples
Action at the bottom edge
Floating action
FloatButton remains at the edge of the area. Positioning is limited to the example card; on the working page default fixed refers to viewport.
<script lang="ts">
import { FloatButton } from '@woodger/antd';
let count = $state(0);
</script>
<style>
.stage {
position: relative;
min-height: 180px;
border: 1px dashed var(--ant-color-border);
border-radius: 8px;
isolation: isolate;
}
output {
display: block;
margin-top: 16px;
}
</style>
<div
class="stage"
><p>{("Action at the bottom edge")}</p><FloatButton
aria-label={("Perform floating action")}
style="
position: absolute;
inset-inline-end: 16px;
inset-block-end: 16px;
"
onclick={() => { count += 1; }}
/></div>
<output aria-label={("Clicking FloatButton")}>{count}</output>
Types and unavailable action
default and primary define the design; disabled disables the native button.
<script lang="ts">
import { FloatButton } from '@woodger/antd';
</script>
<style>
.row {
display: flex;
align-items: flex-start;
flex-wrap: wrap;
gap: 16px;
isolation: isolate;
}
</style>
<div
class="row"
><FloatButton
aria-label={("Normal action")}
style="
position: relative;
inset: auto;
"
/><FloatButton
aria-label={("Main action")}
type="primary"
style="
position: relative;
inset: auto;
"
/><FloatButton
aria-label={("Unavailable action")}
disabled
style="
position: relative;
inset: auto;
"
/></div>
Button shape
circle and square; the group shapes its children through context.
<script lang="ts">
import { FloatButton } from '@woodger/antd';
</script>
<style>
.row {
display: flex;
align-items: flex-start;
flex-wrap: wrap;
gap: 16px;
isolation: isolate;
}
</style>
<div
class="row"
><FloatButton
aria-label={("Round button")}
shape="circle"
content={("?")}
style="
position: relative;
inset: auto;
"
/><FloatButton aria-label={("Square button")} shape="square" content={("?")} style="
position: relative;
inset: auto;
" /></div>
Contents and link
content accepts text or snippet. href creates a real link.
<script lang="ts">
import { FloatButton } from '@woodger/antd';
</script>
<style>
.row {
display: flex;
align-items: flex-start;
flex-wrap: wrap;
gap: 16px;
isolation: isolate;
}
</style>
{#snippet icon()}<span aria-hidden="true">i</span>{/snippet}
<div class="row">
<FloatButton
aria-label={("Project Help")}
shape="square"
content={("HELP")}
style="
position: relative;
inset: auto;
"
/>
<FloatButton
aria-label={("Project contacts")}
shape="square"
content={("@")}
href={("/contacts")}
style="
position: relative;
inset: auto;
"
/>
<FloatButton
aria-label={("Project information")}
icon={icon}
content={("INFO")}
shape="square"
style="
position: relative;
inset: auto;
"
/>
</div>
Action prompt
tooltip accepts a string or public Tooltip props. The tooltip complements the available button name.
<script lang="ts">
import { FloatButton } from '@woodger/antd';
</script>
<style>
.stage {
position: relative;
min-height: 180px;
border: 1px dashed var(--ant-color-border);
border-radius: 8px;
isolation: isolate;
}
</style>
<div class="stage">
<FloatButton aria-label={("Help with hint")} content={("?")} tooltip={({
title: "Open project help",
placement: 'left'
})} style="
position: absolute;
inset-inline-end: 16px;
inset-block-end: 16px;
" />
</div>
Action group
items contains separate snippets. group shape takes precedence over children's shape; The type of actions is specified for each separately.
<script lang="ts">
import { FloatButton, FloatButtonGroup } from '@woodger/antd';
let result = $state(("Select action"));
</script>
<style>
.stage {
position: relative;
min-height: 180px;
border: 1px dashed var(--ant-color-border);
border-radius: 8px;
isolation: isolate;
}
output {
display: block;
margin-top: 16px;
}
</style>
{#snippet help()}
<FloatButton aria-label={("Action Help")} content={("?")} onclick={() => {
result = ("Help");
}} />
{/snippet}
{#snippet feedback()}<FloatButton
aria-label={("Action Feedback")}
content={("!")}
onclick={() => { result = ("Feedback"); }}
/>{/snippet}
<div class="stage"><FloatButtonGroup
shape="square"
items={([{ key: 'help', children: help }, { key: 'feedback', children: feedback }])}
style="
position: absolute;
inset-inline-end: 16px;
inset-block-end: 16px;
"
/></div>
<output aria-label={("Select FloatButton group")}>{result}</output>
Click and hover menu
trigger selects click or hover. Selecting a child action does not automatically close the group.
<script lang="ts">
import { FloatButton, FloatButtonGroup } from '@woodger/antd';
let trigger = $state<'click' | 'hover'>('click');
let result = $state(("Select action"));
</script>
<style>
.stage {
position: relative;
min-height: 180px;
border: 1px dashed var(--ant-color-border);
border-radius: 8px;
isolation: isolate;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
output {
display: block;
margin-top: 16px;
}
</style>
{#snippet help()}
<FloatButton aria-label={("Action Help")} content={("?")} onclick={() => {
result = ("Help");
}} />
{/snippet}
{#snippet feedback()}<FloatButton
aria-label={("Action Feedback")}
content={("!")}
onclick={() => { result = ("Feedback"); }}
/>{/snippet}
<div
class="controls"
>
<label>{("Group Trigger ")}<select
bind:value={trigger}
>
<option
value="click"
>
{("Press")}
</option>
<option value="hover">
{("Guidance")}
</option>
</select></label>
</div>
<div
class="stage"
><FloatButtonGroup
{trigger}
aria-label={("Floating Action Menu")}
content={("+")}
items={([{ key: 'help', children: help }, { key: 'feedback', children: feedback }])}
style="
position: absolute;
inset-inline-end: 16px;
inset-block-end: 16px;
"
/></div>
<output aria-label={("FloatButton menu action")}>{result}</output>
Controlled opening
open and onOpenChange are related to the application state. External buttons control the same menu.
<script lang="ts">
import { Button, FloatButton, FloatButtonGroup } from '@woodger/antd';
let open = $state(false);
let result = $state(("Select action"));
</script>
<style>
.stage {
position: relative;
min-height: 180px;
border: 1px dashed var(--ant-color-border);
border-radius: 8px;
isolation: isolate;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
output {
display: block;
margin-top: 16px;
}
</style>
{#snippet help()}
<FloatButton aria-label={("Action Help")} content={("?")} onclick={() => {
result = ("Help");
}} />
{/snippet}
{#snippet feedback()}<FloatButton
aria-label={("Action Feedback")}
content={("!")}
onclick={() => { result = ("Feedback"); }}
/>{/snippet}
<div
class="controls"
><Button
onclick={() => { open = true; }}
>{("Open group")}</Button><Button
onclick={() => { open = false; }}
>{("Close group")}</Button></div>
<div
class="stage"
><FloatButtonGroup
trigger="click"
{open}
onOpenChange={next => { open = next; }}
aria-label={("Controlled Action Menu")}
content={("+")}
items={([{ key: 'help', children: help }, { key: 'feedback', children: feedback }])}
style="
position: absolute;
inset-inline-end: 16px;
inset-block-end: 16px;
"
/></div>
<output aria-label={("Expanding FloatButton")}>{(open ? "Open" : "Closed")}</output>
<p><output aria-label={("Selected floating action")}>{result}</output></p>
Opening direction
placement specifies the position of the list relative to the trigger. The trigger position leaves room for the list in the selected direction.
<script lang="ts">
import { FloatButton, FloatButtonGroup, type FloatButtonPlacement } from '@woodger/antd';
let placement = $state<FloatButtonPlacement>('top');
let result = $state(("Select action"));
const positions: Record<FloatButtonPlacement, string> = {
top: `
inset-block-end: 16px;
inset-block-start: auto;
inset-inline-start: calc(50% - 20px);
inset-inline-end: auto;
`,
bottom: `
inset-block-start: 16px;
inset-block-end: auto;
inset-inline-start: calc(50% - 20px);
inset-inline-end: auto;
`,
left: `
inset-inline-end: 16px;
inset-inline-start: auto;
inset-block-start: calc(50% - 20px);
inset-block-end: auto;
`,
right: `
inset-inline-start: 16px;
inset-inline-end: auto;
inset-block-start: calc(50% - 20px);
inset-block-end: auto;
`
};
</script>
<style>
.stage {
position: relative;
min-height: 180px;
border: 1px dashed var(--ant-color-border);
border-radius: 8px;
isolation: isolate;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
{#snippet help()}
<FloatButton aria-label={("Action Help")} content={("?")} onclick={() => {
result = ("Help");
}} />
{/snippet}
{#snippet feedback()}<FloatButton
aria-label={("Action Feedback")}
content={("!")}
onclick={() => { result = ("Feedback"); }}
/>{/snippet}
<div
class="controls"
>
<label>{("Menu direction ")}<select
bind:value={placement}
>
<option
value="top"
>
{("Top")}
</option>
<option value="bottom">
{("Bottom")}
</option>
<option value="left">
{("Left")}
</option>
<option value="right">
{("Right")}
</option>
</select></label>
</div>
<div
class="stage"
style="min-height:260px"
><FloatButtonGroup
trigger="click"
open
{placement}
aria-label={("Directional menu")}
content={("+")}
items={([{ key: 'help', children: help }, { key: 'feedback', children: feedback }])}
style={`
position: absolute;
${positions[placement]}
`}
/></div>
<p><output aria-label={("Selected floating action")}>{result}</output></p>
Return to the beginning of the container
target selects the scroll container, visibilityHeight is the appearance threshold, duration is the return duration. ConfigProvider.floatButton changes backTopIcon.
<script lang="ts">
import { Button, ConfigProvider, FloatButtonBackTop } from '@woodger/antd';
let area = $state<HTMLDivElement>();
</script>
<style>
.stage {
position: relative;
min-height: 180px;
border: 1px dashed var(--ant-color-border);
border-radius: 8px;
isolation: isolate;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
.scroll {
height: 180px;
overflow: auto;
border-radius: 8px;
}
</style>
{#snippet up()}<span aria-hidden="true">↑</span>{/snippet}
<div class="controls">
<Button onclick={() => { if (area) area.scrollTop = 260; }}>
{("Scroll list")}
</Button>
</div>
<ConfigProvider floatButton={{ backTopIcon: up }}>
<div class="stage"><div class="scroll" bind:this={area} role="region" aria-label={("BackTop List")}>
<div style="
height: 760px;
padding: 12px;
">
{("Start of list")}
</div>
</div><FloatButtonBackTop
aria-label={("To the top of the list")}
target={() => area ?? null}
visibilityHeight={100}
duration={300}
style="
position: absolute;
inset-inline-end: 16px;
inset-block-end: 16px;
"
/></div>
</ConfigProvider>
Scroll ring
showProgress shows the scroll percentage of the selected target. Returning to the beginning simultaneously resets progress.
<script lang="ts">
import { Button, FloatButtonBackTop } from '@woodger/antd';
let area = $state<HTMLDivElement>();
</script>
<style>
.stage {
position: relative;
min-height: 180px;
border: 1px dashed var(--ant-color-border);
border-radius: 8px;
isolation: isolate;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
.scroll {
height: 180px;
overflow: auto;
border-radius: 8px;
}
</style>
<div class="controls">
<Button onclick={() => { if (area) area.scrollTop = 300; }}>
{("Scroll to progress")}
</Button>
</div>
<div class="stage"><div class="scroll" bind:this={area} role="region" aria-label={("List with progress")}>
<div style="
height: 780px;
padding: 12px;
">
{("List contents")}
</div>
</div><FloatButtonBackTop
aria-label={("Up with progress")}
target={() => area ?? null}
visibilityHeight={80}
showProgress
duration={300}
style="
position: absolute;
inset-inline-end: 16px;
inset-block-end: 16px;
"
/></div>
Counter and Badge point
badge accepts compatible Badge options. status/text/title/children excluded; the available name is given to the button itself.
<script lang="ts">
import { FloatButton } from '@woodger/antd';
let count = $state(5);
</script>
<style>
.row {
display: flex;
align-items: flex-start;
flex-wrap: wrap;
gap: 16px;
isolation: isolate;
}
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
<div
class="controls"
><label>{("Icon counter ")}<input
type="range"
min="0"
max="12"
bind:value={count}
/><output>{count}</output></label></div>
<div class="row"><FloatButton aria-label={("Notifications with counter")} badge={{
count,
showZero: true
}} style="
position: relative;
inset: auto;
" /><FloatButton aria-label={("New notice")} badge={{
dot: true
}} style="
position: relative;
inset: auto;
" /></div>
Semantic slots and group configuration
Local styles style the root/icon/content buttons. ConfigProvider.floatButtonGroup specifies styles for elements and their icons.
<script lang="ts">
import { ConfigProvider, FloatButton, FloatButtonGroup } from '@woodger/antd';
</script>
<style>
.row {
display: flex;
align-items: flex-start;
flex-wrap: wrap;
gap: 16px;
isolation: isolate;
}
</style>
{#snippet first()}<FloatButton
aria-label={("First completed action")}
/>{/snippet}
{#snippet second()}<FloatButton
aria-label={("Second completed action")}
/>{/snippet}
<div class="row">
<FloatButton
aria-label={("Designed button")}
content={("i")}
classNames={{ root: 'custom-float-button' }}
styles={(
{
props
}
) => ({
root: `border:2px solid ${props.type === 'default' ? '#722ed1' : '#08979c'}`,
content: `
color: #722ed1;
font-weight: 600;
`
})}
style="
position: relative;
inset: auto;
"
/>
<ConfigProvider floatButtonGroup={{
styles: {
root: `
padding: 8px;
border: 1px dashed var(--ant-color-border);
`,
itemIcon: 'color:#722ed1'
}
}}>
<FloatButtonGroup items={([{ key: 'first', children: first }, {
key: 'second',
children: second
}])} style="
position: relative;
inset: auto;
" />
</ConfigProvider>
</div>
Actions in a group and return to the beginning of a separate scroll area.
End of list
Actions and project scrolling
Saved review example: action group and BackTop with progress.
<script lang="ts">
import { Button, FloatButton, FloatButtonGroup, FloatButtonBackTop } from '@woodger/antd';
let scrollArea = $state<HTMLDivElement>();
let clicks = $state(0);
</script>
<style>
.scroll-actions {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
margin-top: 12px;
}
output {
display: block;
margin-top: 16px;
}
</style>
<p>{("Actions in a group and return to the beginning of a separate scroll area.")}</p>
{#snippet help()}<FloatButton
aria-label={("Help FloatButton")}
tooltip={("Help")}
content={("?")}
onclick={() => { clicks++; }}
/>{/snippet}
{#snippet feedback()}<FloatButton
aria-label={("Feedback FloatButton")}
content={("!")}
onclick={() => { clicks++; }}
/>{/snippet}
<div style="
display: flex;
gap: 24px;
align-items: flex-start;
flex-wrap: wrap;
isolation: isolate;
">
<FloatButtonGroup
class="ant-float-btn-pure"
shape="square"
items={([
{ key: 'help', children: help },
{ key: 'feedback', children: feedback }
])}
/>
<div style="max-width:100%">
<div
aria-label={("Scroll Area FloatButton")}
bind:this={scrollArea}
style="
height: 140px;
width: 240px;
max-width: 100%;
overflow: auto;
border: 1px solid var(--ant-color-border);
border-radius: var(--ant-border-radius);
"
>
<div style="
height: 600px;
padding: 12px;
">{("Start of list")}</div>
<p>{("End of list")}</p>
</div>
<div class="scroll-actions">
<Button onclick={() => { if (scrollArea) scrollArea.scrollTop = 260; }}>
{("Scroll FloatButton example")}
</Button>
<FloatButtonBackTop
class="ant-float-btn-pure"
aria-label={("Back to top FloatButton")}
target={() => scrollArea ?? null}
visibilityHeight={100}
showProgress
/>
</div>
</div>
</div>
<output aria-label={("FloatButton Actions")}>{clicks}</output>
A child button without prefixCls inherits Group; an empty line selects ConfigProvider. BackTop and Progress retain independent settings. The buttons are limited to the example area.
FloatButton CSS prefixes
Common namespace ConfigProvider and local prefixCls; the state of the component is preserved when the name is changed.
<script lang="ts">
import {
Checkbox,
ConfigProvider,
FloatButton,
FloatButtonGroup,
FloatButtonBackTop
} from '@woodger/antd';
let custom = $state(true);
let local = $state(true);
const prefix = $derived(custom ? 'suite' : 'ant');
const localPrefix = $derived(local ? 'project-float-btn' : '');
let open = $state(false);
let clicks = $state(0);
let scrollTarget = $state<HTMLDivElement>();
</script>
<style>
.example,
.prefix-stage {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 16px;
min-width: 0;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
p { margin: 0; }
output { overflow-wrap: anywhere; }
.floating-stage {
position: relative;
min-height: 220px;
isolation: isolate;
}
.scroll-target {
width: 65%;
height: 200px;
overflow: auto;
border: 1px dashed var(--ant-color-border);
}
</style>
<div class="example">
<div class="controls">
<Checkbox bind:checked={custom}>{("Common prefix FloatButton suite")}</Checkbox>
<Checkbox bind:checked={local}>{("Local prefix FloatButton")}</Checkbox>
</div>
<ConfigProvider prefixCls={prefix} theme={{ cssVar: { prefix: 'float-button-theme' } }}>
<div class="prefix-stage">
{#snippet action()}<FloatButton
aria-label={("FloatButton action with prefix")}
content={("!")}
onclick={() => clicks++}
/>{/snippet}
<div class="floating-stage">
<FloatButtonGroup
prefixCls={localPrefix}
{open}
onOpenChange={next => open = next}
trigger="click"
content={("+")}
aria-label={("FloatButton menu with prefix")}
items={([{ key: 'action', children: action }])}
style="
position: absolute;
inset-inline-end: 16px;
inset-block-end: 16px;
"
/>
<div class="scroll-target" bind:this={scrollTarget}>
<div style="
height: 340px;
padding: 12px;
">{("Scroll this area")}</div>
</div>
<FloatButtonBackTop prefixCls={localPrefix} target={() => scrollTarget!}
visibilityHeight={30} duration={0} showProgress aria-label={("To the top of the area with prefix")}
style="
position: absolute;
inset-inline-start: 16px;
inset-block-end: 16px;
" />
</div>
<output aria-label={("FloatButton actions with prefix")}>{("Actions: ")}{clicks}</output>
</div>
</ConfigProvider>
<output
aria-label={("CSS prefix FloatButton")}
>{("General: ")}{prefix}{("; local: ")}{(localPrefix
|| ("from the provider"))}</output>
<p>
{("A child button without prefixCls inherits Group; an empty line selects ConfigProvider. BackTop and Progress retain independent settings. The buttons are limited to the example area.")}
</p>
</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 |
|---|---|
| Basic | Positioned action. |
| Type | default/primary/disabled. |
| Shape | circle/square. |
| Content | Text, icon and link. |
| FloatButton with tooltip | Tooltip props. |
| FloatButton Group | Individual snippets and overall shape. |
| Menu mode | click/hover. |
| Controlled mode | open and onOpenChange. |
| placement | Four directions of the list. |
| draggable | Group drag and drop API is missing from React 6.7. Native HTML draggable does not implement this scenario. |
| BackTop | Own scroll target and duration. |
| Progress ring | Scroll share. |
| badge | Number and point. |
| Custom semantic dom styling | Local slots and group configuration. |
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Basic button prefix. undefined inherits Group if there is one; an empty line selects ConfigProvider. Group gets the base prefix without -group. | string | ConfigProvider.prefixCls + "-float-btn" |
type | Button design; in the group refers to trigger, children set their own type. | default | primary | default |
shape | Shape; The shape of a group takes precedence among its children. | circle | square | circle |
icon | String or snippet of the icon. | ButtonContent | Document icon |
content | Text or snippet of the button content. | ButtonContent | — |
tooltip | Hint with text or parameter object. | FloatButtonContent | TooltipProps | — |
badge | Badge without status/text/title/children. | FloatButtonBadge | — |
href | Native link instead of button. | string | — |
disabled | Unavailable action; can be inherited from Form/ConfigProvider. | boolean | false |
onclick | Native Svelte callback; onClick is saved as a compatible alias. | MouseEventHandler | — |
classNames | Local classes root/icon/content. | ButtonSlots | function | — |
styles | CSS strings for these slots. | ButtonSlots | function | — |
nativeElement | Native action ref. | HTMLButtonElement | HTMLAnchorElement | — |
FloatButtonGroup
items — key/children snippets array; children is also supported. trigger: click/hover, open: boolean, onOpenChange: callback. placement: top/bottom/left/right, closeIcon: content of the closing icon. Selecting a child action does not automatically close the menu.
FloatButtonBackTop
target returns Window, Document, HTMLElement, or null. default visibilityHeight is 400px, duration is 450ms, showProgress is false. onclick is called along with the start of the return. bind:nativeElement is missing while the button is not visible.
Semantic DOM
FloatButton creates a native button or a with root/icon/content slots. FloatButtonGroup creates a div role="group", list and trigger; available root/list/item/itemIcon/itemContent/trigger/triggerIcon/triggerContent. styles accepts CSS strings, objects and functions are supported.
In the examples, positioning is limited to local areas so that actions do not overlap the site menu. In an application, default fixed refers to the viewport; consider the header and z-index.
ConfigProvider.floatButtonGroup applies group styles. ConfigProvider.floatButton has backTopIcon; class/style/classNames/styles are present in the types, but the installed FloatButton does not read them yet. For a single button, use local props.
Registration tokens
The public ComponentTokenMap.FloatButton does not yet describe named component tokens, and the theme.components.FloatButton mechanism is not connected. Own design is shown through styles and group configuration. General colors and sizes are inherited from the theme.
| Token | Current value |
|---|---|
colorBorderSecondary | #f0f0f0 |
colorPrimary | #2f54eb |
colorText | rgba(0,0,0,0.88) |
borderRadius | 6 |
borderRadiusLG | 8 |
boxShadowSecondary |
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)
|
controlHeight | 32 |
controlHeightLG | 40 |
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 |
fontSizeIcon | 12 |
fontSizeSM | 12 |
lineHeight | 1.5714285714285714 |
lineWidthBold | 2 |
marginLG | 24 |
marginXXL | 48 |
motionDurationMid | 0.2s |
motionDurationSlow | 0.3s |
padding | 16 |
paddingXXS | 4 |
zIndexPopupBase | 1000 |
FAQ
How to set multiple actions in a group?
Pass items with unique key and children snippets. The general form is inherited, the content and type are set by the child FloatButton.
Why doesn't the guided menu open?
We need trigger=click/hover and taking next from onOpenChange to the open state.
Why didn't BackTop appear?
Check the readiness of target, scrollTop and visibilityHeight. Returning null means waiting for the container.
How to limit buttons to an area?
Set a local containing block and appropriate CSS positioning, as in the examples. By default, buttons are anchored relative to the viewport.