Componentform1.02 KB gzipZero dependencies

Fab

Floating action button fixed in corner with hover growth, ripple press, and tooltip label on hover.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add fab

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { Fab } from "@/components/ui/fab" <Fab label="Add" position="bottom-right" onClick={() => {}} />

Source code

fab.tsx + 2 helpers

Zero third-party dependencies (3 local files shown in tabs below).

tsxfab.tsx133 lines
"use client"; import * as React from "react";import { registerEscapeLayer } from "./lib/focus-trap";import { cn } from "./lib/utils"; export type FabPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left"; export type FabAction = {  id: string;  label: string;  icon?: React.ReactNode;  onSelect?: () => void;}; export type FabProps = {  label?: string;  icon?: React.ReactNode;

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { Fab } from "@/components/ui/fab"; <Fab />
PropTypeDescription
labelstringTooltip label on hover.
iconReact.ReactNodeOptional custom SVG icon component or text.
positionFabPositionCorner position.
actionsFabAction[]Configures actions.
onClick() => voidOn click handler.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.