Introduction
Components
- Accordion
- Action Sheet
- Alert
- Audio Player
- Audio Recorder
- Audio Waveform
- Avatar
- AvoidKeyboard
- Badge
- BottomSheet
- Button
- Camera
- Camera Preview
- Card
- Carousel
- Checkbox
- Collapsible
- Color Picker
- Combobox
- Date Picker
- File Picker
- Gallery
- Hello Wave
- Icon
- Image
- Input
- Input OTP
- Link
- MediaPicker
- Mode Toggle
- Onboarding
- ParallaxScrollView
- Picker
- Popover
- Progress
- Radio
- ScrollView
- SearchBar
- Separator
- Share
- Sheet
- Skeleton
- Spinner
- Switch
- Table
- Tabs
- Text
- Toast
- Toggle
- Video
- View
Charts
Installation
pnpm dlx bna-ui add spinner
Usage
import {
Spinner,
LoadingOverlay,
InlineLoader,
ButtonSpinner,
} from '@/components/ui/spinner';
<Spinner size='default' variant='default' />
Examples
Default
Variants
Sizes
With Labels
Speed Control
Custom Colors
Loading Overlay
Inline Loader
API Reference
Spinner
The main spinner component with multiple variants and customization options.
Prop | Type | Default | Description |
---|---|---|---|
size | 'default' | 'sm' | 'lg' | 'icon' | 'default' | The size of the spinner. |
variant | 'default' | 'cirlce' | 'dots' | 'pulse' | 'bars' | 'default' | The visual variant of the spinner. |
label | string | - | Optional label text to display with spinner. |
showLabel | boolean | false | Whether to show the default "Loading..." label. |
style | ViewStyle | - | Additional styles to apply to the container. |
color | string | - | Custom color for the spinner. |
speed | 'slow' | 'normal' | 'fast' | 'normal' | Animation speed of the spinner. |
LoadingOverlay
A full-screen overlay component with spinner for blocking UI interactions during loading.
Prop | Type | Default | Description |
---|---|---|---|
visible | boolean | - | Whether the overlay is visible. |
backdrop | boolean | true | Whether to show a backdrop behind the spinner. |
backdropColor | string | - | Custom backdrop color. |
backdropOpacity | number | 0.5 | Opacity of the backdrop (0-1). |
onRequestClose | () => void | - | Callback when overlay should be closed. |
...spinnerProps | SpinnerProps | - | All props from the Spinner component. |
InlineLoader
A compact spinner optimized for inline usage within text or small containers.
Prop | Type | Default | Description |
---|---|---|---|
size | 'default' | 'sm' | 'lg' | 'icon' | 'sm' | The size of the spinner. |
variant | 'default' | 'cirlce' | 'dots' | 'pulse' | 'bars' | 'default' | The visual variant of the spinner. |
color | string | - | Custom color for the spinner. |
ButtonSpinner
A spinner component specifically designed for button loading states.
Prop | Type | Default | Description |
---|---|---|---|
size | 'default' | 'sm' | 'lg' | 'icon' | 'sm' | The size of the spinner. |
variant | 'default' | 'cirlce' | 'dots' | 'pulse' | 'bars' | 'default' | The visual variant of the spinner. |
color | string | - | Custom color for the spinner. |
Accessibility
The Spinner component is built with accessibility in mind:
- Provides meaningful loading states for screen readers
- Supports custom labels for better context
- Maintains proper contrast ratios for visibility
- Non-intrusive animations that respect user preferences
- Loading overlays properly manage focus and interaction states