suiss/ui · Component
FAB
A floating action button pinned to the bottom corner, with an optional label and speed-dial actions.
FAB is an open-source component from suiss/ui for React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.

Fab is a round primary Pressable rendered through a portal and pinned to the bottom-end corner of the screen, above the safe-area insets. It comes in default and lg sizes, and becomes an extended pill when you pass a label.
When it has FabAction children, pressing it opens a speed dial: a scrim dims the screen and the actions rise above the button one after another. The plus icon rotates 45 degrees into a close mark; other icons swap to an X.
Installation
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/fab.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/fab.tsx:
- Update the import paths to match your project setup.
- Install the following dependencies:
-
Copy the animated view into
components/ui/animated-view.tsx:
- Copy the primitives it uses into
components/primitives:
- Copy and paste the following code into
components/ui/fab.tsx:
- Update the import paths to match your project setup.
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Apply the Compose compiler plugin, enable Compose, set
compileSdkto 37 or higher andminSdkto 24 or higher, and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Examples
Large
Set size to lg. This one also passes a custom icon.
Use the default plus icon or pass any Phosphor icon to icon. Give an icon-only button an accessibilityLabel.

Extended
Pass a label to show text beside the icon and turn the button into a pill.

Large extended
Combine the lg size with a label.

Speed dial open
A speed dial that starts open. Each action rises above the button with its icon and label.

Speed dial closed
A speed dial that opens on press.

Controlled
A speed dial controlled with open and onOpenChange.

Accessibility
- The button and each action have the
buttonrole. - With actions, the button reports its
expandedstate. - The VoiceOver escape gesture and the Android back button close the speed dial.
- The scrim is hidden from screen readers.
API Reference
Fab
Floating button that also hosts the speed dial.
| Prop | Type | Default |
|---|---|---|
size | FabSize | "default" |
icon | PhosphorIcon | PlusIcon |
label | React.ReactNode | - |
open | boolean | - |
defaultOpen | boolean | false |
onOpenChange | (open: boolean) => void | - |
portalHost | string | - |
children | React.ReactNode | - |
Also accepts the props of React.ComponentProps<typeof Pressable>.
icon defaults to a plus, and label can be text or a node. Add FabAction children to turn the button into a speed dial; tapping the scrim or pressing the Android back button closes it. Use open, defaultOpen and onOpenChange to control it, and pass portalHost to render into a named portal host. The position follows the safe-area insets and flips sides in right-to-left layouts. Animations respect the system Reduce Motion setting.
FabAction
One action in the speed dial, with an icon and optional label.
| Prop | Type | Default |
|---|---|---|
icon | PhosphorIcon | Required |
children | React.ReactNode | - |
Also accepts the props of React.ComponentProps<typeof Pressable>.
Pass the optional text label as children. Pressing an action calls its onPress and closes the dial. Actions use bg-muted in dark mode.
FabSize
Values: .default, .lg.
Fab
Floating button that also hosts the speed dial.
| Parameter | Type | Default |
|---|---|---|
_ label | LocalizedStringKey? | nil |
size | FabSize: .default | .lg | .default |
isExpanded | Binding<Bool>? | nil |
icon | () -> Icon | - |
actions | () -> Actions | - |
accessibilityLabel | LocalizedStringKey | - |
action | () -> Void | - |
Overloads: init(_:size:isExpanded:icon:actions:), init(accessibilityLabel:size:isExpanded:icon:actions:), init(_:size:action:icon:), init(accessibilityLabel:size:action:icon:), init(_:size:isExpanded:actions:), init(accessibilityLabel:size:isExpanded:actions:).
FabAction
One action in the speed dial, with an icon and optional label.
| Parameter | Type | Default |
|---|---|---|
_ title | LocalizedStringKey | - |
action | () -> Void | - |
icon | () -> Icon | - |
verbatim | String | - |
Overloads: init(_:action:icon:), init(verbatim:action:icon:).
FabSize
Values: Default, Lg.
Fab
Floating button that also hosts the speed dial.
| Parameter | Type | Default |
|---|---|---|
icon | ImageVector | - |
contentDescription | String | - |
onClick | () -> Unit | - |
modifier | Modifier | Modifier |
size | FabSize: Default | Lg | FabSize.Default |
label | String? | null |
enabled | Boolean | true |
open | Boolean | - |
onOpenChange | (Boolean) -> Unit | - |
actions | @Composable ColumnScope.() -> Unit | - |
Overloads: Fab(icon, contentDescription, onClick), Fab(icon, contentDescription, open, onOpenChange, actions).
FabAction
One action in the speed dial, with an icon and optional label.
| Parameter | Type | Default |
|---|---|---|
icon | ImageVector | - |
label | String | - |
onClick | () -> Unit | - |
modifier | Modifier | Modifier |






