Floating Action Button
An elevated circular action button anchored above screen content.
v0.2.1NativeWindStyleSheetiOSAndroidExpo GoWeb
Preview
Installation
npx nativra-cli add fabWrites Fab.tsx to components/ui, rewrites imports to your aliases and records hashes in nativra.lock.json, along with 2 registry dependencies. Existing files are never overwritten without asking.
Want to try it first? Open it in the playground: a real React Native project in your browser, with this item installed by the CLI.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| accessibilityLabel | string | required | Screen reader accessibility label |
| variant | "primary" | "secondary" | "accent" | "primary" | Semantic elevation color treatment |
| size | "sm" | "md" | "lg" | "md" | FAB dimensions (sm: 44pt, md: 56pt, lg: 64pt) |
| position | "bottom-right" | "bottom-left" | "bottom-center" | "bottom-right" | Fixed viewport anchor position |
| label | string | undefined | Optional extended FAB text label |
| disabled | boolean | false | Disables interaction |
| children | React.ReactNode | required | Icon component |
| onPress | () => void | undefined | Press action callback |
Source
Exactly what the CLI writes, before your import aliases are applied.
Dependencies
Registry items
- useThemeColorsHookReturns the installed theme's semantic colors for the current light/dark scheme, and the installed style's tokens and helpers. Used by every component.
- Class Names UtilityUtilityUtility function for conditionally merging class names with clsx and tailwind-merge (NativeWind) or flattening style objects (StyleSheet).
npm packages
- class-variance-authority^0.7.1