{"id":48821844,"url":"https://github.com/cateiru/react-mini-fab","last_synced_at":"2026-04-14T15:33:54.970Z","repository":{"id":320121458,"uuid":"1079252616","full_name":"cateiru/react-mini-fab","owner":"cateiru","description":"A lightweight and customizable Mini Floating Action Button (Mini FAB) component for React applications. This component provides an easy way to add a floating action button to your UI, enhancing user interaction and accessibility.","archived":false,"fork":false,"pushed_at":"2026-04-14T05:10:58.000Z","size":735,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-14T07:22:23.777Z","etag":null,"topics":["floating-action-button","npm","react"],"latest_commit_sha":null,"homepage":"https://cateiru.github.io/react-mini-fab/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cateiru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-19T12:42:18.000Z","updated_at":"2026-04-13T01:01:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"762f857e-074d-462b-9d73-09b7ed6e777a","html_url":"https://github.com/cateiru/react-mini-fab","commit_stats":null,"previous_names":["cateiru/react-mini-fab"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/cateiru/react-mini-fab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cateiru%2Freact-mini-fab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cateiru%2Freact-mini-fab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cateiru%2Freact-mini-fab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cateiru%2Freact-mini-fab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cateiru","download_url":"https://codeload.github.com/cateiru/react-mini-fab/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cateiru%2Freact-mini-fab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31803521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T11:13:53.975Z","status":"ssl_error","status_checked_at":"2026-04-14T11:13:53.299Z","response_time":153,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["floating-action-button","npm","react"],"created_at":"2026-04-14T15:33:53.877Z","updated_at":"2026-04-14T15:33:54.952Z","avatar_url":"https://github.com/cateiru.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Mini Floating Action Button\n\n[![NPM](https://img.shields.io/badge/NPM-%23CB3837.svg?style=for-the-badge\u0026logo=npm\u0026logoColor=white)](https://www.npmjs.com/package/react-mini-fab) [![Storybook](https://img.shields.io/badge/-Storybook-FF4785?style=for-the-badge\u0026logo=storybook\u0026logoColor=white)](https://cateiru.github.io/react-mini-fab/)\n\nA lightweight and customizable Mini Floating Action Button (Mini FAB) component for React applications. This component provides an easy way to add a floating action button to your UI, enhancing user interaction and accessibility.\n\n![Demo](./public/demo.gif)\n\n## Features\n\n- **Draggable** - Vertically draggable with position persistence via localStorage\n- **Touch Support** - Full touch event support for mobile devices with scroll prevention during drag\n- **Smooth Animations** - Elegant show/hide animations and position transitions\n- **Flexible Positioning** - Support for left and right screen positions with animated switching\n- **Badge Support** - Optional badge indicator for notifications or status\n- **Highly Customizable** - Configurable colors, icons, and accessibility labels\n- **TypeScript Support** - Full TypeScript type definitions included\n- **Lightweight** - Minimal dependencies and optimized bundle size\n- **Accessibility First** - Built with ARIA labels and keyboard navigation support\n\n## Installation\n\n### Prerequisites\n\nThis library requires React as a peer dependency. Make sure you have React installed in your project:\n\n- React 17.x, 18.x, or 19.x\n\nIf you don't have React installed, install it first:\n\n```bash\nnpm install react react-dom\n```\n\n```bash\nyarn add react react-dom\n```\n\n```bash\npnpm add react react-dom\n```\n\n### Install react-mini-fab\n\nInstall the package using your preferred package manager:\n\n```bash\nnpm install react-mini-fab\n```\n\n```bash\nyarn add react-mini-fab\n```\n\n```bash\npnpm add react-mini-fab\n```\n\n## Usage\n\nHere's a basic example of how to use the MiniFAB component:\n\n```tsx\nimport { MiniFAB } from 'react-mini-fab';\n\nimport 'react-mini-fab/style.css';\n\nfunction App() {\n  return (\n    \u003cMiniFAB\n      onClick={() =\u003e console.log('FAB clicked!')}\n      position=\"right\"\n      title=\"Help\"\n      ariaLabel=\"Open help window\"\n      backgroundColor=\"#007bff\"\n      draggableId=\"help-fab\"\n    \u003e\n      \u003csvg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"\u003e\n        {/* Your icon SVG */}\n      \u003c/svg\u003e\n    \u003c/MiniFAB\u003e\n  );\n}\n```\n\n## Props API\n\n### MiniFABProps\n\n| Prop | Type | Required | Default | Description |\n|------|------|----------|---------|-------------|\n| `onClick` | `() =\u003e void` | No | - | Callback function invoked when the button is clicked |\n| `isHide` | `boolean` | No | `false` | Controls the visibility of the button. When `true`, the button is hidden and automatically receives `disabled` and `aria-disabled` attributes for improved accessibility |\n| `title` | `string` | No | - | Tooltip text displayed when hovering over the button |\n| `ariaLabel` | `string` | **Yes** | - | Accessibility label for screen readers |\n| `backgroundColor` | `string` | **Yes** | - | Background color of the button (any valid CSS color) |\n| `color` | `string` | No | `#000000` | Color of the button text/icon (any valid CSS color) |\n| `position` | `\"left\" \\| \"right\"` | No | `\"left\"` | Position of the button on the screen |\n| `draggableId` | `string` | No | - | Unique identifier for the draggable functionality. When provided, the vertical position is saved to localStorage |\n| `badge` | `Badge` | No | - | Badge configuration to display on the button |\n| `includeFixedClassName` | `boolean` | No | `false` | Whether to include fixed class names for custom styling purposes |\n| `children` | `React.ReactNode` | No | - | Content to be rendered inside the button (typically an icon or text) |\n\n### Badge\n\n| Prop | Type | Required | Description |\n|------|------|----------|-------------|\n| `color` | `string` | **Yes** | Background color of the badge (any valid CSS color) |\n\n## Examples\n\n### With Badge Indicator\n\n```tsx\n\u003cMiniFAB\n  onClick={() =\u003e console.log('Notification clicked')}\n  position=\"right\"\n  ariaLabel=\"Notifications\"\n  backgroundColor=\"#ff6b6b\"\n  draggableId=\"notification-fab\"\n  badge={{ color: \"#00ff00\" }}\n\u003e\n  \u003cNotificationIcon /\u003e\n\u003c/MiniFAB\u003e\n```\n\n### Dynamic Position Switching\n\n```tsx\nfunction App() {\n  const [position, setPosition] = useState\u003c\"left\" | \"right\"\u003e(\"left\");\n\n  return (\n    \u003c\u003e\n      \u003cbutton onClick={() =\u003e setPosition(position === \"left\" ? \"right\" : \"left\")}\u003e\n        Toggle Position\n      \u003c/button\u003e\n      \u003cMiniFAB\n        position={position}\n        ariaLabel=\"Settings\"\n        backgroundColor=\"#9b59b6\"\n        draggableId=\"settings-fab\"\n      \u003e\n        \u003cSettingsIcon /\u003e\n      \u003c/MiniFAB\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n### Show/Hide Control\n\n```tsx\nfunction App() {\n  const [isHidden, setIsHidden] = useState(false);\n\n  return (\n    \u003c\u003e\n      \u003cbutton onClick={() =\u003e setIsHidden(!isHidden)}\u003e\n        {isHidden ? 'Show' : 'Hide'} FAB\n      \u003c/button\u003e\n      \u003cMiniFAB\n        isHide={isHidden}\n        ariaLabel=\"Help\"\n        backgroundColor=\"#3498db\"\n        draggableId=\"help-fab\"\n      \u003e\n        \u003cHelpIcon /\u003e\n      \u003c/MiniFAB\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n### With Custom Text\n\n```tsx\n\u003cMiniFAB\n  onClick={() =\u003e console.log('Chat opened')}\n  ariaLabel=\"Open chat\"\n  backgroundColor=\"#2ecc71\"\n  draggableId=\"chat-fab\"\n\u003e\n  \u003cspan style={{ color: '#fff', fontWeight: 'bold' }}\u003eChat\u003c/span\u003e\n\u003c/MiniFAB\u003e\n```\n\n## Accessibility\n\nThis component is built with accessibility in mind:\n\n- **ARIA Labels**: The `ariaLabel` prop is required to ensure screen readers can properly identify the button's purpose\n- **Keyboard Navigation**: The FAB is fully keyboard accessible using standard button interactions. When `isHide` is `true`, the button is automatically excluded from keyboard tab navigation\n- **Disabled State Support**: When hidden (`isHide={true}`), the button receives both `disabled` and `aria-disabled` attributes, ensuring proper accessibility for screen readers and keyboard users\n- **Focus Indicators**: Clear focus outlines for keyboard navigation\n- **Semantic HTML**: Uses proper `\u003cbutton\u003e` element for interactive functionality\n- **Tooltip Support**: Optional `title` prop provides additional context on hover\n\n## Development\n\nThis library is built using modern tooling and best practices:\n\n### Build\n\n```bash\npnpm run build\n```\n\nThe build process generates both UMD and ES module formats:\n\n- UMD: `dist/index.umd.cjs` (for CommonJS environments)\n- ES Module: `dist/index.js` (for modern bundlers)\n- TypeScript definitions: `dist/index.d.ts`\n\n### Testing\n\n```bash\n# Run tests\npnpm run test\n\n# Run tests with UI\npnpm run test:ui\n\n# Run tests with coverage\npnpm run test:coverage\n```\n\n### Storybook\n\nView and interact with component examples:\n\n```bash\n# Start Storybook dev server\npnpm run dev:storybook\n\n# Build Storybook\npnpm run build:storybook\n```\n\n### Code Quality\n\n```bash\n# Lint and format with Biome\npnpm run check:write\n```\n\n## LICENSE\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcateiru%2Freact-mini-fab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcateiru%2Freact-mini-fab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcateiru%2Freact-mini-fab/lists"}