Introducing PrimeReact v11-alpha 🎉Discover Now

SpeedDial

An unstyled, accessible speed dial component with compound composition.

Build fully custom floating action menus with complete control over layout and styling.

basic-demo

Pre-styled Versions

Choose a pre-styled library to use SpeedDial with ready-made designs.
For hook-based usage without components, see the Headless API.

Features#

  • Compound component API with sub-components: Root, Trigger, List, Item, Action
  • Four layout types: linear, circle, semi-circle, quarter-circle
  • Eight direction options for linear and radial positioning
  • Configurable staggered transition delay per item
  • Auto-close on outside click

Usage#

import { SpeedDial } from 'primereact/speeddial';
<SpeedDial.Root>
    <SpeedDial.Trigger></SpeedDial.Trigger>
    <SpeedDial.List>
        <SpeedDial.Item index={0}>
            <SpeedDial.Action></SpeedDial.Action>
        </SpeedDial.Item>
    </SpeedDial.List>
</SpeedDial.Root>

Behavior#

Polymorphic Rendering#

Use as on any sub-component to change the rendered HTML element.

<SpeedDial.Root as="nav">
    <SpeedDial.Trigger as="div">...</SpeedDial.Trigger>
    <SpeedDial.List as="div">
        <SpeedDial.Item as="div" index={0}>
            <SpeedDial.Action as="a" href="/edit">
                ...
            </SpeedDial.Action>
        </SpeedDial.Item>
    </SpeedDial.List>
</SpeedDial.Root>

Default elements: Root=div, Trigger=button, List=ul, Item=li, Action=button.

Render Function Children#

Item accepts a render function as children, providing access to the component instance.

<SpeedDial.Item index={0}>{(instance) => <button>{instance.speeddial?.state.visible ? 'Open' : 'Closed'}</button>}</SpeedDial.Item>

Pass Through#

Some parts may not be visible in the preview depending on the component's current state.

Loading...
/* Select a part to see its CSS selector for custom styling */

API#

SpeedDialRoot#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SpeedDialRootInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SpeedDialRootInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSpeedDialRootInstance—
The instance to pass to the component.
ptSafeRecord<SpeedDialRootPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SpeedDialRootInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
visibleboolean—
Whether the speeddial is visible or not.
defaultVisibleboolean—
Whether the speeddial is visible or not.
direction"left" | "right" | "up" | "down" | "up-left" | "up-right" | "down-left" | "down-right"up
Specifies the opening direction of actions.
transitionDelaynumber30
Transition delay step for each action item.
type"circle" | "linear" | "semi-circle" | "quarter-circle"linear
Specifies the opening type of actions.
radiusnumber0
Radius for *circle types.
hideOnClickOutsidebooleantrue
Whether the actions close when clicked outside.
disabledbooleanfalse
Whether the component is disabled.
onVisibleChange(event: SpeedDialRootVisibleChangeEvent) => void—
Callback fired when the speeddial's visibility changes.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"speeddial"
data-part"root"

Defines passthrough(pt) options of SpeedDial component.

labeltypedescription
rootSpeedDialRootPassThroughType<HTMLAttributes<HTMLDivElement>>Used to pass attributes to the root's DOM element.
triggerSpeedDialRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the trigger's DOM element.
listSpeedDialRootPassThroughType<HTMLAttributes<HTMLUListElement>>Used to pass attributes to the list's DOM element.
itemSpeedDialRootPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the item's DOM element.
actionSpeedDialRootPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the action's DOM element.

SpeedDialTrigger#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SpeedDialTriggerInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SpeedDialTriggerInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSpeedDialTriggerInstance—
The instance to pass to the component.
ptSafeRecord<SpeedDialTriggerPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SpeedDialTriggerInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
iconOnlybooleantrue
Whether to show the SpeedDialTrigger with a borderless style.
roundedbooleantrue
Whether to show the SpeedDialTrigger with a rounded style.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"speeddial"
data-part"trigger"
data-openPresent when menu is open
data-closedPresent when menu is closed

Defines passthrough(pt) options of SpeedDialTrigger component.

labeltypedescription
rootSpeedDialTriggerPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

SpeedDialList#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SpeedDialListInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SpeedDialListInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSpeedDialListInstance—
The instance to pass to the component.
ptSafeRecord<SpeedDialListPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SpeedDialListInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"speeddial"
data-part"list"

Defines passthrough(pt) options of SpeedDialList component.

labeltypedescription
rootSpeedDialListPassThroughType<HTMLAttributes<HTMLUListElement>>Used to pass attributes to the root's DOM element.

SpeedDialItem#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SpeedDialItemInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SpeedDialItemInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSpeedDialItemInstance—
The instance to pass to the component.
ptSafeRecord<SpeedDialItemPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SpeedDialItemInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"speeddial"
data-part"item"
data-activePresent when item is focused

Defines passthrough(pt) options of SpeedDialItem component.

labeltypedescription
rootSpeedDialItemPassThroughType<HTMLAttributes<HTMLLIElement>>Used to pass attributes to the root's DOM element.

SpeedDialAction#

NameTypeDefault
refRef<unknown>—
The reference to the component instance.
pIfbooleantrue
Whether the component should be rendered.
styleCSSProperties | ((instance?: SpeedDialActionInstance) => CSSProperties)—
The style to apply to the component.
classNamestring | ((instance?: SpeedDialActionInstance) => string)—
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>—
The component type to render.
asChildbooleanfalse
Whether the component should be rendered as a child component.
instanceSpeedDialActionInstance—
The instance to pass to the component.
ptSafeRecord<SpeedDialActionPassThrough>—
The pass-through props to pass to the component.
ptOptionsPassThroughOptions—
The pass-through options to pass to the component.
unstyledboolean—
Whether the component should be rendered without classes.
dtunknown—
The design token to use for the component.
stylesStylesOptions<ComponentInstance>—
The styles to use for the component.
render(instance: SpeedDialActionInstance) => ReactNode—
The render function to render the component with instance access.
childrenany—
The children to render. Accepts `React.ReactNode` for static content or a render function `(instance: I) => React.ReactNode` for instance access. Typed as `any` to avoid JSX type errors when used directly in templates.
iconOnlybooleantrue
Whether to show the SpeedDialAction with a borderless style.
severitystring & {} | "secondary" | "info" | "success" | "warn" | "danger" | "contrast" | "help"'secondary'
Severity type of the SpeedDialAction.
roundedbooleantrue
Whether to show the SpeedDialAction with a rounded style.
size"small" | "large"'small'
Size of the Button.
[key: string]any—
pt-{optionName}-*-—
Pass through attributes for customizing component. For more info, see Pass Through tab.
AttributeValue
data-scope"speeddial"
data-part"action"

Defines passthrough(pt) options of SpeedDialAction component.

labeltypedescription
rootSpeedDialActionPassThroughType<HTMLAttributes<HTMLButtonElement>>Used to pass attributes to the root's DOM element.

Accessibility#

Screen Reader#

The trigger button includes aria-haspopup, aria-expanded, and aria-controls to define the relationship between the button and the popup menu. The popup list uses role="menu" and each action has role="menuitem". Use aria-label on each Action to provide an accessible name.

KeyFunction
enterToggles the visibility of the menu.
spaceToggles the visibility of the menu.
down arrowOpens the menu and moves focus to the first item.
up arrowOpens the menu and moves focus to the last item.
right arrowOpens the menu and moves focus to the last item.
left arrowOpens the menu and moves focus to the first item.
escapeCloses the menu.
KeyFunction
enterActivates the menuitem, closes the menu and sets focus on the menu button.
spaceActivates the menuitem, closes the menu and sets focus on the menu button.
escapeCloses the menu and sets focus on the menu button.
arrow keysNavigates between the menu items.
homeMoves focus to the first item.
endMoves focus to the last item.