- Accordion
- Action Sheet
- Alert
- Audio Player
- Audio Recorder
- Audio Waveform
- Avatar
- 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
Component input-demo
does not have a preview available.
Installation
pnpm dlx bna-ui add input
Usage
import { Input, GroupedInput, GroupedInputItem } from '@/components/ui/input';
<Input label='Username' placeholder='Enter your username' icon={User} />
Examples
Default
Component input-demo
does not have a preview available.
With Icons
Component input-icons
does not have a preview available.
Variants
Component input-variants
does not have a preview available.
Validation States
Component input-validation
does not have a preview available.
Right Components
Component input-right-components
does not have a preview available.
Disabled State
Component input-disabled
does not have a preview available.
Grouped Inputs
Component input-grouped
does not have a preview available.
Form Example
Component input-form
does not have a preview available.
API Reference
Input
The main input component with label, validation, and icon support.
Prop | Type | Default | Description |
---|---|---|---|
label | string | - | Label text displayed inside the input |
error | string | - | Error message to display below the input |
icon | React.ComponentType<LucideProps> | - | Lucide icon component to display on the left |
rightComponent | ReactNode | (() => ReactNode) | - | Component or function returning component for right side |
containerStyle | ViewStyle | - | Style for the outer container |
inputStyle | TextStyle | - | Style for the text input |
labelStyle | TextStyle | - | Style for the label text |
errorStyle | TextStyle | - | Style for the error message |
variant | 'filled' | 'outline' | 'filled' | Visual variant of the input |
disabled | boolean | false | Whether the input is disabled |
Extends all TextInputProps
except style
.
GroupedInput
Container component for grouping multiple inputs together.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | - | Child components (usually GroupedInputItem) |
containerStyle | ViewStyle | - | Style for the container |
title | string | - | Optional title for the group |
titleStyle | TextStyle | - | Style for the title text |
GroupedInputItem
Input component designed to be used within GroupedInput.
Prop | Type | Default | Description |
---|---|---|---|
label | string | - | Label text displayed inside the input |
error | string | - | Error message (displayed at group level) |
icon | React.ComponentType<LucideProps> | - | Lucide icon component to display on the left |
rightComponent | ReactNode | (() => ReactNode) | - | Component or function returning component for right side |
inputStyle | TextStyle | - | Style for the text input |
labelStyle | TextStyle | - | Style for the label text |
errorStyle | TextStyle | - | Style for the error message |
disabled | boolean | false | Whether the input is disabled |
Extends all TextInputProps
except style
.
Accessibility
The Input component is built with accessibility in mind:
- Proper focus management and keyboard navigation
- Screen reader support with semantic labeling
- High contrast support for error states
- Proper touch targets for mobile devices
- Support for dynamic text sizing
- Keyboard shortcuts and hardware keyboard support
Styling
The Input component uses your theme colors and can be customized:
filled
variant: Uses card background with subtle bordersoutline
variant: Transparent background with prominent borders- Error states: Uses danger/red theme color
- Focus states: Uses primary theme color
- Disabled states: Reduced opacity with muted colors
Best Practices
- Use clear, descriptive labels
- Provide helpful placeholder text
- Show validation errors immediately after user interaction
- Group related inputs using GroupedInput
- Use appropriate input types (email, password, etc.)
- Consider using icons to clarify input purpose
- Ensure sufficient contrast for accessibility