FloatButton
FloatButton keeps a high-priority shortcut available over the page content.
@duskmoon-dev/components/float-button Usage
When to use
- Use it when users need to move between sections, pages, steps, or contextual actions.
- Expose current and disabled state so navigation remains clear to keyboard and screen-reader users.
Implementation notes
Features
Covers the route, section, step, or action-list patterns that help users move through an interface.
Shows selected, active, open, or current props where the component exposes them.
FloatButton is most often configured through `icon`, `type`, `shape`, `tooltip`.
Renders icon, type, shape, description, tooltip, and badge
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Basic usage
Import the component stylesheet and FloatButton from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { FloatButton } from "@duskmoon-dev/components/float-button";
export function Example() {
return (<FloatButton type="primary" icon="+" tooltip="Create" />);
} Renders icon, type, shape, description, tooltip, and badge
test-backedFloatButton scenario from the component test coverage: renders icon, type, shape, description, tooltip, and badge.
import "@duskmoon-dev/components/styles.css";
import { FloatButton } from "@duskmoon-dev/components/float-button";
export function FloatButtonRendersIconTypeShapeDemo() {
return (<FloatButton type="primary" icon="+" tooltip="Create" />);
} Supports links, disabled links, refs, and overflow badge count
test-backedFloatButton scenario from the component test coverage: supports links, disabled links, refs, and overflow badge count.
import "@duskmoon-dev/components/styles.css";
import { FloatButton } from "@duskmoon-dev/components/float-button";
export function FloatButtonSupportsLinksDisabledLinksDemo() {
return (<FloatButton type="primary" icon="+" tooltip="Create" />);
} Renders group with inherited shape and trigger state
test-backedFloatButton scenario from the component test coverage: renders group with inherited shape and trigger state.
import "@duskmoon-dev/components/styles.css";
import { FloatButton } from "@duskmoon-dev/components/float-button";
export function FloatButtonRendersGroupWithInheritedDemo() {
return (<FloatButton type="primary" icon="+" tooltip="Create" />);
} Back top becomes visible and scrolls target
test-backedFloatButton scenario from the component test coverage: back top becomes visible and scrolls target.
import "@duskmoon-dev/components/styles.css";
import { FloatButton } from "@duskmoon-dev/components/float-button";
export function FloatButtonBackTopBecomesVisibleDemo() {
return (<FloatButton type="primary" icon="+" tooltip="Create" />);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<FloatButton type="primary" icon="+" tooltip="Create" />
</div>
<div data-theme="moonlight">
<FloatButton type="primary" icon="+" tooltip="Create" />
</div> API
The API reference below lists every parsed exported type or interface for FloatButton. Start with `icon`, `type`, `shape`, `tooltip` for common usage.
packages/components/src/components/float-button/FloatButton.types.ts
Scenarios: packages/components/src/components/float-button/FloatButton.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
icon | ReactNode | No | icon configures FloatButton. |
type | FloatButtonType | No | type configures FloatButton. |
shape | FloatButtonShape | No | shape configures FloatButton. |
tooltip | FloatButtonTooltip | No | tooltip configures FloatButton. |
description | ReactNode | No | description configures FloatButton. |
badge | FloatButtonBadge | No | badge configures FloatButton. |
href | string | No | href configures FloatButton. |
target | string | No | target configures FloatButton. |
children | ReactNode | No | children configures FloatButton. |
onClick | MouseEventHandler<HTMLElement> | No | onClick configures FloatButton. |
| Prop | Type | Required | Description |
|---|---|---|---|
title | ReactNode | No | title configures FloatButton. |
placement | FloatButtonTooltipPlacement | No | placement configures FloatButton. |
| Prop | Type | Required | Description |
|---|---|---|---|
count | ReactNode | No | count configures FloatButton. |
dot | boolean | No | dot configures FloatButton. |
color | string | No | color configures FloatButton. |
overflowCount | number | No | overflowCount configures FloatButton. |
| Prop | Type | Required | Description |
|---|---|---|---|
shape | FloatButtonShape | No | shape configures FloatButton. |
trigger | FloatButtonGroupTrigger | No | trigger configures FloatButton. |
open | boolean | No | open configures FloatButton. |
closeIcon | ReactNode | No | closeIcon configures FloatButton. |
children | ReactNode | No | children configures FloatButton. |
onClick | MouseEventHandler<HTMLElement> | No | onClick configures FloatButton. |
| Prop | Type | Required | Description |
|---|---|---|---|
visibilityHeight | number | No | visibilityHeight configures FloatButton. |
target | () => Window | HTMLElement | null | No | target configures FloatButton. |
"default" | "primary" "circle" | "square" "click" | "hover" "top" | "bottom" | "left" | "right" ReactNode | FloatButtonTooltipConfig ForwardRefExoticComponent< FloatButtonProps & RefAttributes<HTMLButtonElement | HTMLAnchorElement> > & { Group: ForwardRefExoticComponent< FloatButtonGroupProps & RefAttributes<HTMLDivElement> >