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
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add fabOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { Fab } from "@/components/ui/fab" <Fab label="Add" position="bottom-right" onClick={() => {}} />Source code
fab.tsx + 2 helpersZero 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 />| Prop | Type | Description |
|---|---|---|
| label | string | Tooltip label on hover. |
| icon | React.ReactNode | Optional custom SVG icon component or text. |
| position | FabPosition | Corner position. |
| actions | FabAction[] | Configures actions. |
| onClick | () => void | On click handler. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |